C Program to Calculate Simple Interest
C
Program to Calculate Simple Interest
·
Write a C program to
read principal amount, rate of interest and time and calculate simple interest.
·
Wap in C to find simple
interest.
Required Knowledge
·
C
printf and scanf functions
·
C Arithmetic
Operators
We
will first read Principle amount, rate of interest and time using scanf
function. We will use below mentioned formulae to calculate Simple
Interest (SI).
C program to calculate simple interest
/*
* C program to calculate simple interest
*/
#include
<stdio.h>
int main() {
float principle, rate, time,
simpleInterest;
/*
* Take Principle, Rate of interest and
* Time as input from user.
*/
printf("Enter Principle
Amount\n");
scanf("%f", &principle);
printf("Enter Rate of
Interest\n");
scanf("%f", &rate);
printf("Enter Time of
Loan\n");
scanf("%f", &time);
/*
* Simple Interest = (Principle X Rate X
Time)/100;
*/
simpleInterest = (principle * rate *
time)/100;
printf("Simple Interest = %.2f",
simpleInterest);
return 0;
}
Output
Enter Principle Amount
10000
Enter Rate of Interest
5
Enter Time of Loan
2
Simple Interest = 1000.00
Comments
Post a Comment