Simple interest is calculated by multiplying the principal amount, the interest rate, and the time period. The formula for simple interest is:
I = (P * R * T) / 100
Where I is the interest, P is the principal amount, R is the interest rate, and T is the time period.
Here is an example C++ program that calculates the simple interest:
//C++ Example Program to find Simple Interest #include <iostream> using namespace std; int main() { float P, R, T, I; // Input the principal amount, interest rate, and time period cout << "Enter the principal amount: "; cin >> P; cout << "Enter the interest rate: "; cin >> R; cout << "Enter the time period: "; cin >> T; // Calculate the simple interest I = (P * R * T) / 100; // Display the result cout << "Simple Interest = " << I; return 0; }
Enter the principal amount: 10000
Enter the interest rate: 10
Enter the time period: 5
Simple Interest = 5000
In this example, the user is prompted to input the principal amount, interest rate, and time period. The program then calculates the simple interest using the formula and displays the result.
Also read:
No comments:
Post a Comment