1.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


You might also like to read related C Programs :
  1. Compound interest

6 comments:

  1. change "float p,rate,time,si;" to "float p,r,n,si" cause u hve written si=(p*n*r)/100;

    ReplyDelete
  2. using this program calculate simple interest for rupees 100000

    ReplyDelete
  3. If a line scanf("%f%f%f",&p&n&r);
    We have use comas between &p and&n

    ReplyDelete