10: Write a program that takes salary amount from the user and applies tax to it. If salary is greater than 100000 deduct 10% tax otherwise deduct 5%. Print the net salary, and amount of tax deducted.
// Write a program that takes salary amount from the user and applies tax to it.
// If salary is greater than 100000 deduct 10% tax otherwise deduct 5%.
// Print the net salary, and amount of tax deducted.
#include <iostream>
using namespace std;
int main(){
float gross_salary, five_tax, ten_tax, net_sal_five, net_sal_ten;
cout << "Enter your monthly gross salary: Rs.";
cin >> gross_salary;
if(gross_salary >= 100000){
ten_tax = gross_salary * 0.1;
net_sal_ten = gross_salary - ten_tax;
cout << "Your net salary is: Rs." << net_sal_ten << endl <<
"Tax deducted: Rs." << ten_tax << endl;
}
else{
five_tax = gross_salary * 0.05;
net_sal_five = gross_salary - five_tax;
cout << "Your net salary is: Rs." << net_sal_five << endl <<
"Tax deducted: Rs." << five_tax << endl;
}
return 0;
}
Input 1:
Enter your monthly gross salary: Rs.54000
Output 1:
Your net salary is: Rs.51300
Tax deducted: Rs.2700
Input 2:
Enter your monthly gross salary: Rs.123000
Output 2:
Your net salary is: Rs.110700
Tax deducted: Rs.12300
Comments
Post a Comment