Exercise[6B(c)], LET Us C Solution

 Exercise[6B(c)]

When interest compunds 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.          */

#include<stdio.h>
#include<math.h>
int main()
{
	int i;
	float p,n,r,q,a;
	for(i=1;i<=10;i++)
	{
		printf("Set=%d\n",i);
		printf("Enter principle:");
		scanf("%f",&p);
		printf("Enter Rate:");
		scanf("%f",&r);
		printf("Enter Time(in year):");
		scanf("%f",&n);
		printf("Enter compound interest:");
		scanf("%f",&q);
		a=p*(pow((1+r/q),n*q));
		printf("Amount=%2f\n\n",a);
	}
	return 0;
}

Post a Comment

0 Comments