C++ Program to Compute Gross Salary from Basic, DA and HRA

Write C++ Program to Compute Gross Salary from Basic, DA and HRA

// CPP Program to Compute Gross Salary from Basic, DA and HRA

#include <iostream>

using namespace std;

int main()
{
    float salary, da_percentage, hra_percentage, da, hra, gross_salary;

    cout << "Enter Basic Salary :--> ";
    cin >> salary;

    cout << "Enter DA (perc.) :--> ";
    cin >> da_percentage;

    cout << "Enter HRA (perc.) :--> ";
    cin >> hra_percentage;

    da = (salary * da_percentage) / 100;
    hra = (salary * hra_percentage) / 100;

    gross_salary = salary + da + hra;


    cout << "\nGross salary : " << gross_salary;

    return 0;
}

Output:

Enter Basic Salary :--> 40000
Enter DA (perc.) :--> 50
Enter HRA (perc.) :--> 10

Gross salary : 64000.00

≪ Previous | Next ≫