Program to calculate total interest value with principal amount, rate and time in year.
#include <stdio.h>
#include <math.h>
main ()
{
float p, t, r, si;
printf ("Enter Principal:");
scanf ("%f", &p);
printf ("Enter Rate:");
scanf ("%f", &r);
printf ("Enter Time:");
scanf ("%f", &t);
si = p * t * r / 100;
printf ("The Simple Intrest is:%f\n", si);
getch ();
}
Output:--
Enter Principal: 15000.0
Enter Rate: 25.0
Enter Time: 2.5
The Simple Interest is: 9375.0
How it works
It asks for principal amount, rate of interest and total time in year. Then it calculates the interest by using simple interest formula and gives total interest to be paid at the end.