Calculate Compound Interest in C Program
C Program to input principle, rate, year and calculate compound interest.
Example : pgm.c
#include<stdio.h> #include<math.h> int main(){ float p,r,n,a; printf("\nEnter Principal Amount : "); scanf("%f",&p); printf("\nEnter Rate of Interest : "); scanf("%f",&r); printf("\nEnter Number of Years : "); scanf("%f",&n); a=p*(pow((100+r)/100.0,n)); printf("\nTotal Amount : %f",a); return 0; }
Output:
Enter Principal Amount : 2500 Enter Rate of Interest : 5.5 Enter Number of Years : 2 Total Amount : 2782.562500