C++ Program to Compute Simple Interest
Write C++ Program to Compute Simple Interest
// CPP Program to Compute Simple Interest
#include <iostream>
using namespace std;
int main()
{
int n, d;
float r = 15,ans;
cout << "Enter Amount :--> ";
cin >> n;
cout << "Enter Interest Rate :--> ";
cin >> r;
cout << "Enter Duration (in months) :--> ";
cin >> d;
ans = (n * r * d) / 100;
cout << "\nSimple Interest :--> " << ans;
return 0;
}
Output:
Enter Amount :--> 1000
Enter Interest Rate :--> 1.5
Enter Duration (in months) :--> 12
Simple Interest :--> 180.00