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
Write a program to read 10 sets of p, r, n & q and calculate the corresponding as.
void main()
{
float a,p,r,q,n,x,y,z,w;
a=1;
for(z=1;z<=2;z++)
{
printf("\nEnter the values of p,r,n &q");
scanf("%f%f%f%f",&p,&r,&n,&q);
x=n*q;
for(y=1,a=1;y<=x;y++)
{
a=a*(1+r/q);
}
w=a*p;
printf("\nThe value of a is %f",w);
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment