Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
3.0k views
in Introduction to C++ by (49.1k points)
closed by

Write the C++ program to calculate Net salary. Program to Calculate Net Salary

1 Answer

+1 vote
by (54.8k points)
selected by
 
Best answer

#include

#include using namespace std;

int main()

{

float basic, da, hra, gpf, tax, gross, np; char name[30];

cout<<“\n Enter Basic Pay:”; cin >> basic;

cout<<“\n Enter D.A cin >> da;

cout<<“\n Enter H.R.A:”; cin >> hra;

gross = basic+da+hra; // sum of basic, da nad hra

gpf = (basic+da) * 0.10; //10% of basic and da

tax = gross * 0.10; //10% of gross pay

np = gross – (gpf+tax); //netpay = earnings – deductions

cout<<setw(25) << “Basic Pay:”<<setw(10)<<basic<<endl;

cout<<setw(25)<<“Dearness

Allowance:”<<setw(10) <<da<<endl;

cout<<setw(25)<<“House Rent

Allowance:”<<setw(10)<<hra<<endl;

cout<<setw(25)<<“Gross Pay:” <<setw(10)<<gross<<endl;

cout <<setw(10)<<“G.P.F:”<<setw(10)<<gpf<<endl;

cout<<setw(25)<<“Income Tax:”<<setw(10<<tax<<endl;

cout<<setw(25)<<“Net Pay:”<<setw(10)<<np<<endl;

}

The output will be,

Enter Basic Pay : 12000

Enter D.A : 1250

Enter H.R.A : 1450

Basic Pay : 12000

Dearness Allowance : 1250

House Rent Allowance : 1450

Gross Pay : 14700

G.P.F : 1325

Income Tax : 1470

Net Pay : 11905

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

...