For Advertisements on this blog Contact Us at developgram@gmail.com or +91-9923438816

Simple Programming Tutorials For Beginners

Sunday, December 11, 2016

Compound Interest Calculation

/*
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;
}

No comments:

Post a Comment

SEARCH THIS BLOG