C program to calculate Gross Salary of an employee

This program will read Basic Salary of an employee, calculate other part of the salary on percent basic and finally print the Gross Salary of the employee.

Here, we are reading basic salary of the employee, and calculating HRA, DA, PF and then Gross salary of the employee.

C program for Gross Salary

/* c program to calculate salary of an employee with name */
#include <stdio.h>
 
int main()
{
  
    char name[30];
    float basic, hra, da, pf, gross;
 
    printf("Enter name: ");
    gets(name);
 
    printf("Enter Basic Salary: ");
    scanf("%f",&basic);
    printf("Enter HRA: ");
    scanf("%f",&hra);
    printf("Enter D.A.: ");
    scanf("%f",&da);
     
    /*pf automatic calculated 12%*/
    pf= (basic*12)/100;
 
    gross=basic+da+hra+pf;
 
    printf("\nName: %s \nBASIC: %f \nHRA: %f \nDA: %f \nPF: %f \n***GROSS SALARY: %f ***",name,basic,hra,da,pf,gross);
     
    return 0;
}
Advertisement

Output

Enter name: Mike
Enter Basic Salary: 23000
Enter HRA: 9500
Enter D.A.: 9500

Name: Mike
BASIC: 23000.000000
HRA: 9500.000000
DA: 9500.000000
PF: 2760.000000
***GROSS SALARY: 44760.000000 ***

C Basic Programs »



Related Programs

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT


Comments and Discussions!




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.