How to Calculate Company Gross Salary From Given Basic Pay in C Programming | C Programming Examples - 17
Write a C program to Calculate Company Gross Salary From Given Basic Pay. How to Calculate Company Gross Salary From Given Basic Pay in C programming. Logic to Calculate Company Gross Salary From Given Basic Pay in C program.
Question:
A company decides to Calculate Company Gross Salary From Given Basic Pay on new year. A 20% on salary is given to House Rent Allowance and 40% on salary is given to Dearness Allowance and another 12% is given to Provident Fund. Write a C program to Calculate Company Gross Salary From Given Basic Pay.
C Programming Examples:
1. Write a C Program to Calculate Company Gross Salary From Given Basic Pay
2. C program to Calculate Company Gross Salary From Given Basic Pay
3. How to Calculate Company Gross Salary From Given Basic Pay in C Programming
C Program to Calculate Company Gross Salary From Given Basic Pay : |
#include<stdio.h>
int main(){
float basicPay,dearnessAllowance,houseRentAllowance,grossSalary,providentFund;
printf("Enter Basic Pay \n");
scanf("%f",&basicPay);
houseRentAllowance=0.2*basicPay;
dearnessAllowance=0.4*basicPay;
providentFund=0.12*basicPay;
grossSalary=basicPay+dearnessAllowance+houseRentAllowance+providentFund;
printf("Basic Pay=%.2f\n",basicPay);
printf("Dearness Allowance=%.2f\n",dearnessAllowance);
printf("House Rent Allowance=%.2f\n",houseRentAllowance);
printf("Provident Fund=%.2f\n",providentFund);
printf("Gross Salary=%.2f\n",grossSalary);
}
Output:
Enter Basic Pay
10000
Basic Pay=10000.00
Dearness Allowance=4000.00
House Rent Allowance=2000.00
Provident Fund=1200.00
Gross Salary=17200.00
Explanation of Finding Company Gross Salary From Given Basic Pay in C Programming :
Initializes :
We will first take one input for basic pay from user using scanf function then Calculate Company Gross Salary From Given Basic Pay using following equations:
- houseRentAllowance=0.2*basicPay
- dearnessAllowance=0.4*basicPay
- providentFund=0.12*basicPay
- grossSalary=basicPay+dearnessAllowance+houseRentAllowance+providentFund
Finally print the total gross salary.
0 Response to C Program to Calculate Company Gross Salary From Given Basic Pay | C Programming Examples - 17
Post a Comment