Q. Write an interactive program to calculate simple interest.
Ans.
/*c program for calculate simple interest*/
#include<stdio.h>
#include<conio.h>
int main()
{
float p,rate,time,si;
printf("Enter principal amount : ");
scanf("%f", &p);
printf("Enter rate of interest : ");
scanf("%f", &rate);
printf("Enter time period in year : ");
scanf("%f", &time);
/*calculating simple interest*/
si=(p*time*rate)/100;
printf("\nSimple Interest = %2f",si);
getch();
getch();
return 0;
}
Output :-
Enter principal amount : 1000
Enter rate of interest : 2
Enter time period in year : 1
Simple Interest =20
You might also like to read related C Programs :
change "float p,rate,time,si;" to "float p,r,n,si" cause u hve written si=(p*n*r)/100;
ReplyDeleteWe studyied (p*t*r)/100 only
Deletehelpful for biginers..
ReplyDeletenice
ReplyDeleteusing this program calculate simple interest for rupees 100000
ReplyDeleteIf a line scanf("%f%f%f",&p&n&r);
ReplyDeleteWe have use comas between &p and&n