# Gross Salary from Basic Salary coderinme

#### Gross Salary from Basic Salary

To compute Gross Salary if Basic Salary is given along with other allowances like
DA: Dear Allowance = 70% of Basic Salary
TA: Travel Allowance = 15% of Basic Salary
HRA: House Rent Allowance = 20% of Basic Salary
We just have to add up them all using the following formula:
Gross Salary = BS + DA + TA + HRA
Now let’s code it in C

``````#include<stdio.h>
int main()
{
float gross_salary, base_salary,dearness_allowance,travel_allowance,house_rent_allowance;
printf("Please Enter the Gross Salary: ");
scanf("%f",&base_salary);
dearness_allowance = ( 70.0 / 100 ) * base_salary;
printf("Salary Calculator:\n");
printf("The Base Salary: %10.2f\n",base_salary);
printf("The Dearness Allowance: %10.2f\n",dearness_allowance);
travel_allowance = ( 15.0 / 100 ) * base_salary;
printf("The Travelling Allowance: %10.2f\n",travel_allowance);
house_rent_allowance = ( 20.0 / 100 ) * base_salary;
printf("The House Rent Allowance: %10.2f\n",house_rent_allowance);
gross_salary = base_salary + dearness_allowance + travel_allowance + house_rent_allowance;
printf(" + ________\n");
printf("The Gross salary: %10.2f\n",gross_salary);
getch();
return 0;
}
``````