C Program to Compute Gross Salary from Basic, DA and HRA
Write a Program to Compute Gross Salary from Basic, DA and HRA
// C Program to Compute Gross Salary from Basic, DA and HRA #include <stdio.h> int main() { float salary, da_percentage, hra_percentage, da, hra, gross_salary; printf("Enter Basic Salary :--> "); scanf("%f", &salary); printf("Enter DA (perc.) :--> "); scanf("%f", &da_percentage); printf("Enter HRA (perc.) :--> "); scanf("%f", &hra_percentage); da = (salary * da_percentage) / 100; hra = (salary * hra_percentage) / 100; gross_salary = salary + da + hra; printf("\nGross salary : %0.2f", gross_salary); return 0; }
Output:
Enter Basic Salary :--> 40000
Enter DA (perc.) :--> 50
Enter HRA (perc.) :--> 10
Gross salary : 64000.00