P009.c ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 12 Dec 2025
- License — MIT
Problem Statement ​
Problem Statement
WAP to calculate gross and net salary by accepting basic salary as input. IMP : DA = 30% of Basic Pay HRA = 20% of Basic Pay PF = 12.5% of Basic Pay Gross Salary = Basic Pay + DA + HRA Net Salary = Gross Salary - PF
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include<stdio.h>
int main() {
double bs, da, hra, pf, gs, ns;
printf("Enter the Basic Salary : ");
scanf("%lf", &bs);
da = bs * 0.3;
hra = bs * 0.2;
pf = bs * 0.125;
gs = bs + da + hra;
ns = gs - pf;
printf("\nGross Salary : %lf"
"\nNet Salary : %lf", gs, ns);
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14