luc036.c ​
Metadata ​
- Author — Amit Dutta (amitdutta4255@gmail.com)
- Last updated — 12 Dec 2025
- License — MIT
Problem Statement ​
Problem Statement
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'
Source Code ​
Printing the code
To print this file, open it on GitHub and click Raw before printing, or use the Download Raw button above and print directly from that page.
c
#include <stdio.h>
#include <math.h>
int main()
{
double interest, principalAmount, interestRate, timeInYears, compoundFactor, totalAmount;
int index;
for (index = 1; index <= 10; index++)
{
printf("Enter Principle amount : ");
scanf("%lf", &principalAmount);
printf("Enter Rate of Interest : ");
scanf("%lf", &interestRate);
interestRate *= 0.01;
printf("Enter the Time (Years) : ");
scanf("%lf", &timeInYears);
printf("Compound count in one year : ");
scanf("%lf", &compoundFactor);
totalAmount = (principalAmount * pow((1 + interestRate / compoundFactor), (timeInYears * compoundFactor)));
interest = totalAmount - principalAmount;
printf("\nInterest : %.2f\nTotal Amount : %.2f\n\n", interest, totalAmount);
}
return 0;
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23