Answer to Question #235360 in C# for Sourav

Question #235360
Write a program in C++ to accept
principal, rate and time from user and
find out simple interest if interested is
more than 5000 the user has to pay
2% of tax otherwise no tax.
1
Expert's answer
2021-09-10T01:47:51-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS