🚀⚡Beginner
Find Compound Interest
Calculate compound interest
Compound Interest (CI) is interest calculated on both the initial principal and the accumulated interest from previous periods. It's called "interest on interest" and grows faster than simple interest.
📐 Formula
A = P × (1 + R/100)TCI = A - PA
Final Amount
P
Principal
R
Rate (%)
T
Time (years)
📊 Simple vs Compound Interest (₹10,000 at 5% for 2 years)
Simple Interest
₹1,000
Compound Interest
₹1,025
C Program to Calculate Compound Interest
compound_interest.c
C
1#include <stdio.h>2#include <math.h> // For pow() function34int main() {5 float principal, rate, time, amount, ci;6 7 // Input values8 printf("Enter Principal: ");9 scanf("%f", &principal);10 11 printf("Enter Rate (%%): ");12 scanf("%f", &rate);13 14 printf("Enter Time (years): ");15 scanf("%f", &time);16 17 // Calculate: A = P × (1 + R/100)^T18 amount = principal * pow(1 + rate/100, time);19 20 // Compound Interest = Amount - Principal21 ci = amount - principal;22 23 printf("\nCompound Interest = %.2f\n", ci);24 printf("Total Amount = %.2f\n", amount);25 26 return 0;27}Output
Enter Principal: 10000
Enter Rate (%): 5
Enter Time (years): 2
Compound Interest = 1025.00
Total Amount = 11025.00
📖 Code Explanation
| Code | Explanation |
|---|---|
| #include <math.h> | Required for pow() function |
| pow(base, exp) | Calculates base raised to power exp |
| 1 + rate/100 | Convert percentage to decimal multiplier |
| ci = amount - principal | CI is the extra money earned |
⚠️ Compilation Note
When using <math.h>, link the math library:gcc program.c -lm -o program
🎯 Key Takeaways
✓A = P × (1 + R/100)T
✓CI = A - P (Amount - Principal)
✓pow() from math.h for exponents
✓CI > SI for same values
Related Examples
Want to Learn More?
Explore our comprehensive tutorials for in-depth explanations of C programming concepts.
Browse Tutorials