23. Program that inputs Basic Salary and calculates 35% dearness allowance, 25% house rent and then display the gross salary.

Chapter 4: 

Input And Output

Programming Exercise

Problem # 23:

Write a program that inputs Basic Salary and calculates 35% dearness allowance, 25% house rent and then display the gross salary.

Solution:

#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
    int basicSalary, grossSalary;
    cout<<"Enter basic salary : ";
    cin>>basicSalary;
    float da, hr;        //dearness allowance, house rent
    da = basicSalary * (35.0/100.0);
    hr = basicSalary * (25.0/100.0);
    grossSalary = basicSalary + da + hr;
    cout<<"Gorss Salary : "<<grossSalary<<endl;
    return 0;
}

Let me know in the comment section if you have any question.

Previous Post:
22. Program that inputs five-digit number through the keyboard and calculates the sum of its digits.

Comments