C Program to calculate Simple Interest
Simple interest is given by the formula: $$si = (p * t * r) / 100$$ In this program the user enters: $$p - principal amount \\ t - time (in years) \\ r - rate of interest$$$ This program calculates simple interest by taking the above inputs from the user and prints the result to the console.
Program
#include<stdio.h>
void main()
{
int p, t, r;
float product, si=0;
printf("Enter principal amount, time and rate of interest\n");
printf("Principal amount:\t");
scanf("%d", &p);
printf("Time:\t");
scanf("%d", &t);
printf("Rate of Interest\t");
scanf("%d", &r);
product = p*t*r;
si = (p*t*r)/100;
printf("Simple interest = %f\n", si);
}
Output
Enter principal amount, time and rate of interest
Principal amount: 1200
Time: 12
Rate of Interest 8
Simple interest = 1152.000000