#include<stdio.h>
#include<conio.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);
}
getch();
return 0;
}
Ad
Chapter - 4: The Loop Control Structure
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 Write a program to read 10 sets of p, r, n & q and calculate the corresponding as.
Ad
Ad