#include<iostream>
using namespace std;
int main()
{
// declare variables
float principal, time,rate, interest;
cout << "Enter principal amount: ";
cin >> principal;
cout << "Enter time (years): ";
cin >> time;
cout << "Enter rate (%): ";
cin >> rate;
// calculate interest
interest = (principal*time*rate)/100;
// display result
cout << "Interest = " << interest << endl;
//if interested is more than 5000 the user has to pay 2% of tax otherwise no tax.
float tax=0;
if(interest>5000){
tax=interest*0.02;
}
cout<<"Tax = "<<tax<<endl;
cin>>time;
return 0;
}
Comments
Leave a comment