C Program to calculate Salary of Employee
Get employee wages and number of days worked from user and find Basic Pay, DA, HRA, PF and Net Pay. (Note HRA, DA and PF are 10%,5%and 12% of basicpay respectively.)
Sample Input 1:
300 30
Sample Output 1:
Basic Pay:3000 DA: 150 HRA:300 PF:360 Net Pay: 3090
Flow Chart Design
Try your Solution
Strongly recommended to Solve it on your own, Don't directly go to the solution given below.
Program or Solution
#include<stdio.h>
int main()
{
int wages;
double days,basic,HRA,DA,PF,netsalary;
printf("Enter daily wages and number of days worked:");
scanf("%d %lf",&wages,&days);
basic=wages*days;
HRA=basic*0.1;
DA=basic*0.05;
PF=basic*0.12;
netsalary=basic+HRA+DA-PF;
printf("\nBasic:%lf \nHRA:%lf \nDA:%lf \nPF:%lf \nNet Salary:%lf",basic,HRA,DA,PF,netsalary);
return 0;
}
Program Explanation
Get daily wage of an employee and days worked by the employee. (using scanf statement).
Calculate Basic Pay by multiplying wages & days worked
Calculate HRA by multplying basic pay and 0.1
Calculate DA by multplying basic pay and 0.05
Calculate PF by multiplying basic pay and 0.12
Calculate Net Pay by adding HRA and DA, subracting PF with Basic Pay.
Print Basic Pay, DA, HRA, PF and Net Pay (using printf statement)
Comments
Related Programs
- C Program to Addition of two numbers
- C Program to subtraction of two numbers
- C Program to multiply two numbers
- C Program to divide two numbers
- C Program to find modulus of two numbers
- C Program to convert Kilo Meters to Meters
- C Program to convert Meters to Kilo Meters
- C Program to find area of Square
- C Program to find area of Rectangle
- C Program to find area of Right angled triangle
- C Program to find area of triangle
- C Program to find area of Circle (Use Constant)
- C Program to find the distance between two points in 2D space
- C Program to convert kilobytes to bytes
- C Program to convert bytes to kilobytes
- C Program to find simple interest
- C Program to calculate Fahrenheit to Celsius
- C Program to calculate Celsius to Fahrenheit
- C Program to Swap two numbers using third variable
- C Program to Swap of two numbers without using third variable
- C Program to print the last digit of given number N
- C Program to toggle a bit in number
- C Program to initialize a variable to zero using XOR Operator
- C Program to Compare M * pow(2,n) and M<<N
- C Program to Compare M divided by pow(2,n) and M>>N