C Program For Calculate Net Salary of an employee

Ex: write a C Program for calculate the net salary of an employee. How to write a C program for calculate Net salary of an employee. C program for calculate Net salary of an employee. 


Input from user:

Enter the basic salary of an employee: 10000

Expected output:

Net salary of an employee is: 14000.0000





Step by step logic of the given program:

1. First accept basic salary of an employee. declare variable say b.

2. After that find ta, da and hra using basic salary as follows:

ta=b*40/100;

 da=b*40/100;

 hra=b*60/100;


3. To find Net salary store the addition of ta, da and hra into the net variable-(net=ta+da+hra)

4. Print net salary to the output screen.




Program:


#include<stdio.h>
int main()
{
 float b,ta,da,hra,net;

printf("Enter the basic salary of an employee:\n");
 scanf("%f",&b);

 ta=b*40/100;
 da=b*40/100;
 hra=b*60/100;

 net=ta+da+hra;

 printf("Net salary of an employee is: %f",net);

 return 0;

}



Above program shows the following output:

C Program For Calculate Net Salary of an employee




No comments:

Post a Comment

If you have any doubts, please discuss here...👇