Below is C program to Compound Interest.
Program:
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 | /* Compund Interest */ #include<stdio.h> #include<math.h> int main() { float p,r,i,t,ci,a; printf ( "Type the amount : " ); scanf ( "%f" ,&p); printf ( "Type the interest rate : " ); scanf ( "%f" ,&r); printf ( "Type the period in years: " ); scanf ( "%f" ,&t); i=1+(r/100); // ci=pow(i,t); ci=1; for (a=1;a<=t;a++) ci=ci*i; ci=p*ci-p; printf ( "Your compound interest is : %.2f" ,ci); return 0; } |
No comments:
Post a Comment