Print gross salary of employee - C Program

C program to calculate gross salary.

Basic SalaryDA(Rs.)HRA(Rs.)Conveyance (Rs.)
>=5000120% basic25% Basic600
bs=>3000 && bs<5000110% basic20% basic500
bs<3000100%basic15%basic400

Solution:

#include <stdio.h>
int main()
{
     float bs,hra,da,cv,gs;
     printf("Enter Basic Salary : ");
     scanf("%f", &bs);
     printf("-------------------------------\n");
     if(bs>=5000)
     {
          da=120*bs/100;
          hra=25*bs/100;
          cv=600;
     }
     else
     if(bs>=3000 && bs<5000)
     {
          da= 110*bs/100;
          hra=20*bs/100;
          cv=500;
     }
     else
     if(bs<3000)
     {
          da=100*bs/100;
          hra=15*bs/100;
          cv=400;
     }
     gs=bs+da+hra+cv;
     printf("Basic Salary   : %.2f\n",bs);
     printf("DA             : %.2f\n",da);
     printf("HRA            : %.2f\n",hra);
     printf("Conveyance     : %.2f\n",cv);
     printf("Gross Salary   : %.2f\n",gs);
     return 0;
}


Output:

gross salary employee