#include <stdio.h>
#include <math.h>
int main()
{
float principal, rate, time, CI, finalAmount;
printf("Enter the principal amount: \n");
scanf("%f", &principal);
printf("Enter the rate of interest: \n");
scanf("%f", &rate);
printf("Enter the time period: \n");
scanf("%f", &time);
CI = principal * (pow((1 + rate / 100), time)) - principal;
finalAmount = principal + CI;
printf("Compound Interest = %.3f\n", CI);
printf("Final Amount = %.3f\n", finalAmount);
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: