C program to calculate Simple Interest

Write a C program to input principle, time and rate (P, T, R) from user and find Simple Interest. How to calculate simple interest in C programming. Logic to find simple interest in C program.


Enter principle: 1200
Enter time: 2
Enter rate: 5.4


Simple Interest = 129.600006

Required knowledge

Arithmetic operators, Variables and expressions, Data types, Basic input/output

Simple Interest formula

Simple interest formula is given by.
Simple interest formula

P is the principle amount
T is the time and
R is the rate

Logic to calculate simple interest

Step by step descriptive logic to calculate simple interest.

  1. Input principle amount in some variable say principle.
  2. Input time in some variable say time.
  3. Input rate in some variable say rate.
  4. Find simple interest using formula SI = (principle * time * rate) / 100.
  5. Finally, print the resultant value of SI.

Program to calculate simple interest

 * C program to calculate simple interest

#include <stdio.h>

int main()
    float principle, time, rate, SI;

    /* Input principle, rate and time */
    printf("Enter principle (amount): ");
    scanf("%f", &principle);

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

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

    /* Calculate simple interest */
    SI = (principle * time * rate) / 100;

    /* Print the resultant value of SI */
    printf("Simple Interest = %f", SI);

    return 0;


Enter principle (amount): 1200
Enter time: 2
Enter rate: 5.4
Simple Interest = 129.600006

Happy coding 😉

About Pankaj

Pankaj Prakash is the founder, editor and blogger at Codeforwin. He loves to learn new techs and write programming articles especially for beginners. He works at Vasudhaika Software Sols. as a Software Design Engineer and manages Codeforwin. In short Pankaj is Web developer, Blogger, Learner, Tech and Music lover.

Follow on: Twitter | Google | or

Comments and discussion
Have a doubt, write here. I will help my best.
Before commenting you must escape your source code before commenting. Paste your source code inside
<pre><code> ----Your Source Code---- </code></pre>