2. Basic salary of an employee is input through the keyboard. The DA is 25% of the basic salary while the HRA is 15% of the basic salary. Provident Fund is deducted at the rate of 10% of the gross salary (BS+DA+HRA). Write a program to calculate the Net Salary.

 SOURCE CODE:

#include <stdio.h>

int main()
{   float bs,da,hra,pf,gs,ns;
    printf("enter the basic salary of a employee\n");
    scanf("%f",&bs);
    da=(25.0/100)*bs;
    hra=(15.0/100)*bs;
    gs=bs+da+hra;
    pf=(10.0/100)*gs;
    ns=gs-pf;
    printf("net salary of employee is %f",ns);
    return 0;
}

Comments