## Compound Interest – C Program

### write a c program of calculate compound interest of given amount

The compound interest is a interest of interest.

The Compound Interest is interest of the first period, add it to the total basic amount, and then calculate the interest for the next period, and so on…..

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
#include<stdio.h> #include<conio.h> #include<math.h> void main() { float amt,rate,yr,ans,cans; int i; printf("Enter your basic amount : \n"); scanf("%f",&amt); printf("Enter your interest rate : \n"); scanf("%f",&rate); printf("Enter number of year for calculate interest: \n"); scanf("%f",&yr); ans=1+(rate/100); cans=1; for(i=1;i<=yr;i++) { cans=cans*ans; } cans=amt*cans-amt; printf("The total compound interest is : %.2f",cans); } |

The c program output is :

1 2 3 4 5 6 7 |
Enter your basic amount : 10000 Enter your interest rate : 10 Enter number of year for calculate interest: 2 The total compound interest is = 2100 |

(Visited 21 times, 1 visits today)