C Programs | IT Developer
IT Developer

C Programs



Share with a Friend

Simple Interest vs Compound Interest Year wise Table Calculation Program in C

Introduction (SI vs CI Year-wise Table)

Both Simple Interest (SI) and Compound Interest (CI) use the same principal, rate, and time, but:

  • SI increases linearly (same amount every year).
  • CI increases exponentially (interest is added on accumulated balance).

This program will generate a comparison table showing SI and CI year by year, making it easier to understand the difference.

 

C Program: SI vs CI Year-wise Table Calculation

C

#include <stdio.h>

#include <math.h>   // For pow() function

 

int main() {

    float principal, rate, si, ci, amount;

    int years, i;

 

    // Input values

    printf("Enter Principal amount: ");

    scanf("%f", &principal);

 

    printf("Enter Rate of Interest (in %%): ");

    scanf("%f", &rate);

 

    printf("Enter Time (in years): ");

    scanf("%d", &years);

 

    // Print table header

    printf("\nYear\tSimple Interest\tCompound Interest\n");

    printf("-----------------------------------------\n");

 

    for(i = 1; i <= years; i++) {

        // Calculate SI for year i

        si = (principal * rate * i) / 100;

 

        // Calculate CI for year i

        amount = principal * pow((1 + rate / 100), i);

        ci = amount - principal;

 

        // Print values

        printf("%d\t%.2f\t\t%.2f\n", i, si, ci);

    }

 

    return 0;

}

Output

 
OUTPUT :
Enter Principal amount: 1000
Enter Rate of Interest (in %): 10
Enter Time (in years): 5

Year    Simple Interest   Compound Interest
-----------------------------------------
1       100.00            100.00
2       200.00            210.00
3       300.00            331.00
4       400.00            464.10
5       500.00            610.51

Explanation

  1. User enters Principal, Rate, and Total Time (years).
  2. A for loop runs from year 1 to N.
  3. Each year:
    • SI is calculated as (P×R×i)/100
    • CI is calculated as (P × (1 + R / 100)i ) – P
  4. Results are displayed in a table format.