Program to read principle, time and rate and calculate simple interest

Source Code:

/*to find the simple interest*/
#include<stdio.h>
int main()
{
float p, t, r, si;
printf("Enter the value of principle: ");
scanf("%f", &p);
printf("Enter the time (in years): ");
scanf("%f", &t);
printf("Enter the interest rate: ");
scanf("%f", &r);
si = (p * t * r) / 100;
printf("Simple Interest = %f", si);
return 0;
}

Sample Run:

Enter the value of principle: 10000
Enter the time (in years): 3
Enter the interest rate: 12
Simple Interest = 3600.00


No comments:

Post a Comment