Q:

Write a C program to calculate Simple Interest

0

C program to calculate Simple Interest

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

In this program, variable amount is going to be used to store principal amountrate 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 to calculate simple interest(principal x rate x time )/100

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

C program for 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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C programming Basic Input, Output, if else, Ternary Operator based Programs

Similar questions


need a help?


find thousands of online teachers now
Write a C program to check whether a given number ... >>
<< Write a C program to find quotient and remainder...