Answer:
Check the explanation
Step-by-step explanation:
c++ Program to find Gross salary after deducting tax from the annual salary
In this program user have to enter the annual salary,tax rate.This program continue to run repeatedly untill user gives 0 for annual salary.
#include <iostream>
using namespace std;
int main()
{
double asal,taxPay,trate;
char c;
while(true)
{
cout <<"Enter The Annual Salary ::";
cin>> asal;
if(asal<=0)
{
cout<<"* Program Exit *";
break;
}
cout<<"\\Enter Tax Rate::";
cin>>trate;
taxPay=asal*(trate/100);
cout<<"\\Tax You Have to pay::"<<taxPay<<endl;
}
}
_____________________
Kindly check the first attached image below for the code output.
2) Modified the above program
#include <iostream>
using namespace std;
int main()
{
double asal,taxPay,trate,deduction;
char c;
while(true)
{
cout <<"\\Enter The Annual Salary ::";
cin>> asal;
if(asal<=0)
{
cout<<"* Program Exit *";
break;
}
while(true)
{
cout<<"Enter Salary Deductions::";
cin>>deduction;
if(deduction<=0)
{
break;
}else
{
asal=asal-deduction;
}
}
cout<<"\\Enter Tax Rate::";
cin>>trate;
taxPay=asal*(trate/100);
cout<<"\\Tax You Have to pay::"<<taxPay<<endl;
cout<<"Salary remaining after all deductions::"<<asal;
}
return 0;
}
Kindly check the second attached image below for the code output.