C Tutorial
This c program is used to find the compound interest.
Total Amount = (principal amount * power(1+(rate per annum/ 100), year)) Compound Interest = Total Amount - Principal Amount
#include<stdio.h> #include<math.h> void main() { int p, r, y; double total, ci; printf("Enter principal (p): "); scanf("%d", &p); printf("Enter rate per annum (r): "); scanf("%d", &r); printf("Enter number of years (y): "); scanf("%d", &y); total = (double)p*(pow((1.0+(((double)r)/100)), y)); printf("Total Amount: %lf\n", total); ci = total - p; printf("Compuond interest: %lf\n", ci); }Output:
$ cc compount-interest.c -o a.out -lm $ ./a.out Enter principal (p): 7500 Enter rate per annum (r): 4 Enter number of years (y): 2 Total Amount: 8112.000000 Compuond interest: 612.000000
C Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page