Compound Interest Calculation

By Developgram - December 11, 2016

/*
Summary: Calculates compound interest
*/

#include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
 float p,t,r;
 float compound,a;

 printf("enter principal:\t");
 scanf("%f",&p);

 printf("enter rate of interest:\t");
 scanf("%f",&r);

 printf("enter time in years:\t");
 scanf("%f",&t);

 if((p<1)||(t<1)||(r<1))
  printf("invalid");
 else
 {
  a=(float)p*(pow(1+r/100.0,t));
  compound=a-p;
  printf("the compound interest is rs.%.2f",compound);
 }
 return 0;
}

  • Share:

You Might Also Like

0 comments