In a company an employee is paid as under: If his basic salary is less than Rs. 1500, then HRA = 10% of basic salary and DA = 90% of basic salary. If his salary is either equal to or above Rs. 1500, then HRA = Rs. 500 and DA = 98% of basic salary. If the employee's salary is input by the user write a program to find his gross salary.
#include <iostream> 
using namespace std;
int main() {
  float bs, gs, da, hra;
  cout<<"Please Entered Basic Salary (In Rs.): ";
  cin>>bs;
  if (bs < 500) {
      hra = bs * 10 / 100;
      da = bs * 90 / 100;
  }
  else {
      hra = 500;
      da = bs * 98 / 100;
      }
  gs = bs + hra + da;
  cout<<"Basic Salary Rs. "<<bs<<endl;
  cout<<"HRA Rs. "<< hra<<endl;
  cout<<"DA Rs. "<< da<<endl;
  cout<<"Gross salary Rs. " << gs<<endl;
  return 0;
}
Comments