Monday, May 23, 2016

C program for calculating compound interest

Program
#include<stdio.h>
#include<math.h>
main()
{
float p,r,n,ci;
printf("enter principle,rate,no.of years :\n");
scanf("%f%f%f",&p,&r,&n);
ci=p*(pow((1+r/100),n)-1);
printf("compound interest is:%f",ci);
}

Output
 enter principle,rate,no.of years:
4.2 1.2 3.0
compound interest is:1.036434

No comments:

Post a Comment