#include <iostream>
#include <cmath>
int main() {
double principal, rate, time, interest;
// Input principal amount
std::cout << "Enter the principal amount: ";
std::cin >> principal;
// Input annual interest rate
std::cout << "Enter the annual interest rate (in percentage): ";
std::cin >> rate;
// Input time in years
std::cout << "Enter the time in years: ";
std::cin >> time;
// Convert percentage to decimal
rate = rate / 100;
// Calculate compound interest using for loop
for (int i = 1; i <= time; ++i) {
interest = principal * pow(1 + rate, i) - principal;
std::cout << "Year " << i << ": Interest = " << interest << ", Total Amount = " << principal + interest << std::endl;
}
return 0;
}