How to calculate the Gross Pay c++
Calculate the Gross Pay of a person having Allowance 15% of
the Salary and House Rent 10% of the Salary. Assign a constant value to Salary.
Gross Pay will be calculated by the formula: Gross Pay = Allowance + House
Rent + Salary
STEP#1
Start
STEP#2
Declare the variable Gross Pay, Allowance, HouseRent, Salary
STEP#3 Assign values 45000 to Salary
STEP#4
Calculate the value of Allowance
STEP#5
Allowance= Salary*0.15
STEP#6
Calculate the value of HouseRent
STEP#7
HouseRent= Salary*0.10
STEP#8
Calculate the value Gross Pay
STEP#9
Gross Pay= (Allowance+HouseRent+Salary)
STEP#10
Display the Gross Pay
STEP#11 End
#include <iostream>
using namespace
std;
int main()
{
int
salary,allowance,houserent,gross;
salary=45000;
allowance=(salary*10/100);
houserent=(salary*15/100);
gross=(allowance)+(houserent)+(salary);
cout<<gross;
cout<<allowance;
cout<<houserent;
cout<<salary;
return 0;
}
No comments:
Post a Comment