Simple salary calculation in C Program
Calculate net salary based on giving allowance and deduction percentage using C Program.
Example : pgm.c
#include<stdio.h> int main(){ float all,ded,sal,net_sal; printf("\nEnter Basic Salary : "); scanf("%f",&sal); printf("\nEnter Allowance Percentage : "); scanf("%f",&all); printf("\nEnter Deduction Percentage : "); scanf("%f",&ded); all=sal*(all/100); ded=sal*(ded/100); net_sal=sal+all-ded; printf("\nBasic Salary : %0.2f",sal); printf("\nAllowance Amount : %0.2f",all); printf("\nDeduction Amount : %0.2f",ded); printf("\nNet Salary : %0.2f",net_sal); return 0; }
Output:
Enter Basic Salary : 20000
Enter Allowance Percentage : 4.5
Enter Deduction Percentage : 1.5
Basic Salary : 20000.00
Allowance Amount : 900.00
Deduction Amount : 300.00
Net Salary : 20600.00
Enter Allowance Percentage : 4.5
Enter Deduction Percentage : 1.5
Basic Salary : 20000.00
Allowance Amount : 900.00
Deduction Amount : 300.00
Net Salary : 20600.00