Write a program in java to read 10 sets of p, r, n & q and calculate the corresponding a
Answers
Answered by
0
Answer:
- /* When interest compounds q times per year at an annual rate of r % for n years, the principle p compounds to an amount a as per the following formula a = p (1 + r / q) nq. C Program to read 10 sets of p, r, n & q and calculate the corresponding as */ #include<stdio.h> #include<math.h> int main() { float i, p, q, r, n, a, b; for (i = 1; i <= 10; i++) { printf("\n\nEnter principal, rate, time (in year) and compound interest respectively : "); scanf("%f%f%f%f", &p, &r, &n, &q); b = pow((1 + r / q), n*q); a = p*b; printf("\n%f is the amount.", a); } return 0; }
Similar questions