C program to calculate gross salary: To implement a mathematical equation which calculates the gross salary based on an annual basis.

What is the 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

Page Contents

## Algorithm to calculate gross salary

1. Take input basic pay, HRA, and DA
2. Calculate gross salary by formula
Gross Salary = Basic + DA + HRA
3. Print Gross salary

## C Program to Calculate Gross Salary

```#include<stdio.h>
int main ()
{
//declare variable

int basic,hra, da;

float gross_salary;

//take input

printf ("\n Enter basic pay");

scanf ("%d",&basic);

printf ("\n Enter HRA");

scanf ("%d",&hra);

printf ("\n Enter DA");

scanf ("%d",&da);

//calculate gross salary

gross_salary=basic+hra+da;

printf ("\n Gross salary is = %f",gross_salary);

return 0;

}```

Output: 