C++ Online Compiler
Example: C++ program to enter P, T, R, and calculate Compound Interest
C
C++
C#
Java
Python
PHP
main.cpp
STDIN
Run
// C++ program to enter P, T, R, and calculate Compound Interest #include <iostream> #include <cmath> using namespace std; int main() { float p, t, r, CI; // p = principle // t = time // r = rate // CI = compound interest cout << "Enter the principal (amount), time, and rate::\n"; cin >> p >> t >> r; /* Calculate compound interest */ CI = p * (pow((1 + r / 100), t)); // Output cout << "\nCompound Interest = " << CI; return 0; }
5 7 9
Output
Clear
ADVERTISEMENTS