#include<stdio.h>
int main()
{
float p, r, n, si;
printf("Enter your principle amount:");
scanf("%f",&p);
printf("Enter your rate of interest:");
scanf("%f",&r);
printf("Enter number of years:");
scanf("%f",&n);
si = (p*r*n)/100;
printf("Simple Interest is %.2f", si);
return 0;
}
Output of program
Enter your principle amount:1000
Enter your rate of interest:12
Enter number of years:2
Simple Interest is 240.00
why is written %2f in printing si
ReplyDelete%.2f will help us in printing a number with two decimal points (like 240.00).
Delete