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.


E
Sections
11
Exercises

A

B

C

D

E

1

2

3

4

5

6

7

8

10

11

12

13

14

15

16

9

#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;
}

© 2020 Garbage Valuegarbage value logo