#include <stdio.h>
int main()
{
// 3. Write a program to calculate simple interest (i = (p*r*n)/100 )
// i = Simple interest
// p = Principal amount
// r = Rate of interest
// n = Number of years
float i, p, r, n;
printf("\tSimple Intrest Calculator");
printf("\n======================================");
printf("\n\nEnter The Principal Amount : ");
scanf("%f", &p);
printf("\nEnter Rate Of Intrest : ");
scanf("%f", &r);
printf("\nEnter Number of years : ");
scanf("%f", &n);
printf("\n______________________________________");
i = (p * r * n) / 100;
printf("\n\nFinal Intrest will be : %.2f Rs.", i);
printf("\n\nFormula Used (i = (p*r*n)/100)");
printf("\n______________________________________\n\n");
return 0;
}
i = (p * r * n) / 100
to calculate the simple interest, where i
is the simple interest, p
is the principal amount, r
is the rate of interest, and n
is the number of years.i
, p
, r
, and n
to store the simple interest, principal amount, rate of interest, and number of years, respectively.scanf()
and stored in the variables p
, r
, and n
, respectively.i = (p * r * n) / 100
, and stored in the variable i
.return 0;
at the end of main()
indicates that the program has executed successfully and returns an exit code of 0.