C Program to Calculate the Simple Interest

In this video tutorial lets learn how we can calculate Simple Interest by making use of simple arithmetic operations.

 
#include<stdio.h>

int main()
{
    int p, t;
    float r, si;

    printf("Enter principal amount\n");
    scanf("%d", &p);

    printf("Enter Rate of interest\n");
    scanf("%f", &r);

    printf("Enter time period\n");
    scanf("%d", &t);

    si = (p * t * r) / 100.0;

    printf("Simple Interest is %f\n", si);

    return 0;
}

Output:
Enter principal amount
1000
Enter Rate of interest
14
Enter time period
2
Simple Interest is 280.000000

Scanf(): For user input

In above c program we are asking user to enter the values for variable a and b. You can know more about scanf() method/function in this video tutorial: Using Scanf in C Program

C Program to Calculate the Simple Interest



YouTube Link: https://www.youtube.com/watch?v=DtgTB1ndPrE [Watch the Video In Full Screen.]


In this program we take input for Principal amount, rate of interest and time period from the user, and then calculate Simple Interest for those values.

Simple Interest Logic




We make use of arithmetic operations available in C programming language and convert this formula to calculate Simple Interest.

Simple_Interest = ( Principal_amount * Rate_of_interest * Time) / 100.0;

This gives us Simple Interest and we output the result to the console.

For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert