Saturday, January 21, 2012

Simple interest

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();
 return 0;
}

Output :-

Enter principal amount : 1000
Enter rate of interest : 2
Enter time period in  year : 1
Simple Interest =20

Related Programs :
  1. Compound interest

No comments:

Post a Comment