Computer Science, asked by zoyakhan2830, 10 months ago

Write a program to accept employee id,employee name,basic salary,HRA and DA of the employee from command line argument.calculate total salary if HRA is 20% of basic salary and DA is 10% basic salary use parameterised method.

Answers

Answered by rushilansari
1

Answer:

/**

* 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;

}

Similar questions