C Program to Calculate Simple Interest

1. Introduction

Financial computations are omnipresent in various aspects of life, be it in personal savings, loans, or investments. One of the fundamental financial calculations is the computation of Simple Interest, which gives insight into the amount of interest accrued over a fixed period. This guide will introduce a C program to calculate Simple Interest.

2. Program Overview

Our program aims to:

1. Prompt the user for the principal amount, rate of interest, and time period.

2. Compute the Simple Interest using the standard formula.

3. Display the computed interest to the user.

3. Code Program

#include <stdio.h>  // Integrate the Standard I/O library

int main() {  // Begin main function

    float principal, rate, time, interest;  // Declare variables to store user inputs and computed interest

    // Request user input for principal amount, rate of interest, and time
    printf("Enter Principal Amount ($): ");
    scanf("%f", &principal);

    printf("Enter Rate of Interest (%%): ");
    scanf("%f", &rate);

    printf("Enter Time (years): ");
    scanf("%f", &time);

    // Calculate Simple Interest using the formula: P * R * T / 100
    interest = (principal * rate * time) / 100;

    // Display the calculated interest
    printf("Simple Interest accrued: $%.2f\n", interest);

    return 0;  // End the program gracefully



Enter Principal Amount ($): 1000
Enter Rate of Interest (%): 5
Enter Time (years): 2
Simple Interest accrued: $100.00

4. Step By Step Explanation

1. #include <stdio.h>: Incorporates the standard input and output library, enabling the use of functions like printf and scanf.

2. int main(): The main function where the program starts its execution.

3. Variable Declaration:

  • principal, rate, time, and interest: These variables will hold the input values and the computed interest.

4. User Input:

  • We prompt the user for the principal amount, rate of interest, and time duration.
  • The scanf function is then used to read and store the input values in their respective variables.

5. Simple Interest Calculation:

  • The formula for Simple Interest is given by: SI = P R T / 100
  • Our program uses this formula to compute the interest amount and saves the result in the interest variable.

6. Display Result:

  • We then showcase the derived simple interest to the user. 

This program effectively demystifies the computation of Simple Interest, making it a handy tool for quick financial calculations.