C program to calculate Simple Interest

In this C program, we are going to learn how to calculate simple interest, when principle, rate and time are given?

Given principal (amount), time and interest rate and we have to calculate simple interest based on given rate of given time period.

Calculating Simple Interest

In this program, variable amount is going to be used to store principal amount, rate is going to used to store interest rate and time is going to be used to store time and si is going to be used to store simple interest.

Formula

Formula to calculate simple interest: (principal x rate x time )/100

C program to calculate Simple Interest

/* c program to calculate simple interest*/
#include <stdio.h>
 
int main()
{
    float amount,rate,time,si;
 
    printf("Enter principal (Amount) :");
    scanf("%f",&amount);
 
    printf("Enter rate :");
    scanf("%f",&rate);
 
    printf("Enter time (in years) :");
    scanf("%f",&time);
 
    si=(amount*rate*time)/100;
 
    printf("\nSimple Interest is = %f",si);
 
    return 0;
}

Output

Enter principal (Amount) :15000
Enter rate :2.8
Enter time (in years) :2

Simple Interest is = 840.000000

C Basic Programs »


Related Programs

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.