In this tutorial, we are going to see a new program which is c program to calculate gross salary
What is gross salary?
The gross salary is different from the net salary which is calculated as an annual basis.
How to calculate gross salary
Formula: Gross Salary = Basic + DA + HRA
For this basic => basic pay , DA => dearness allowance, HRA => house rent allowance
The logic to calculate gross salary:
For finding a gross salary we need to take input basic pay, HRA and DA from the user. after that, we calculate the sum of all this sum is our gross salary.
C Program to Calculate Gross Salary
int main ()
int basic,hra, da;
printf ("\n Enter basic pay");
printf ("\n Enter HRA");
printf ("\n Enter DA");
//calculate gross salary
printf ("\n Gross salary is = %f",gross_salary);
1) First, we include preprocessor directives such as stdio.h
2) Start with the main function
3) Next, we declare the variables
Basic => to store basic pay
hra => to store HRA
da => to store DA
gross_salary => to store gross salary.
4) After that, we take the user inputs which are basic pay, HRA, and DA
5) Next, we calculate gross salary which is the sum of all
6) Print Gross salary