/**
* C program to calculate Compound Interest
*/
#include"stdio.h"
#include "math.h"
int main()
{
float principle, rate, time, CI;
// Read principle, time and rate
printf("Enter principle (amount): ");
scanf("%f", &principle);
printf("Enter time: ");
scanf("%f", &time);
printf("Enter rate: ");
scanf("%f", &rate);
// Calculate compound interest
CI = principle* (pow((1 + rate / 100), time) - 1);
// Print the resultant CI
printf("Compound Interest = %f", CI);
return 0;
}
Enter principle (amount): 1500
Enter time: 2
Enter rate: 6.6
Compound Interest = 204.533997
Press any key to continue . . .
"Exploring the C Program to Calculate Compound Interest"
Importing Required Libraries
Main Function
Declaration of Variables
Reading Input
Calculating Compound Interest
Displaying Result
Return Statement
"In conclusion, the C program to calculate compound interest is a simple yet useful program for students, financial analysts, and researchers. The program is easy to understand and can be used to calculate compound interest for various scenarios.
First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.
Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.