This program calculatates the Simple Interest of any given value's in C.
Program Code:
/* C program to calculate simple interest */
#include <stdio.h>
int main()
{
float p, y, r, SI;
printf("Principal Amount : ");
/* get principal from the user */
scanf("%f", &p);
printf("Total No. of Years : ");
/* get year input from user */
scanf("%f", &y);
printf("Rate of Interest (%) : ");
/* get rate of interest from user */
scanf("%f", &r);
/* calculate simple interest */
SI = (p * y * r) / 100;
/* print the calculated simple interest value */
printf("Simple Interest: %.3f\n\n", SI);
return 0;
}
Program Output:
Post a Comment