C Program to Calculate Gross Salary of Employee From Basic Salary Full Project For Beginners

  • Post author:
  • Post category:c++
  • Post comments:0 Comments

 

 

salary.c

 

 

/**
 * C program to calculate gross salary of an employee
 */

#include <stdio.h>

int main()
{
    float basic, gross, da, hra;

    /* Input basic salary of employee */
    printf("Enter basic salary of an employee: ");
    scanf("%f", &basic);


    /* Calculate D.A and H.R.A according to specified conditions */
    if(basic <= 10000)
    {
        da  = basic * 0.8;
        hra = basic * 0.2;
    }
    else if(basic <= 20000)
    {
        da  = basic * 0.9;
        hra = basic * 0.25;
    }
    else
    {
        da  = basic * 0.95;
        hra = basic * 0.3;
    }

    /* Calculate gross salary */
    gross = basic + hra + da;

    printf("GROSS SALARY OF EMPLOYEE = %.2f", gross);

    return 0;
}

 

See also  C Program to Design Football Ground Using Graphics Programming Full Project For Beginners

 

Leave a Reply