-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCI.c
More file actions
28 lines (17 loc) · 632 Bytes
/
CI.c
File metadata and controls
28 lines (17 loc) · 632 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <math.h>
int main() {
double principal, rate, time;
double simpleInterest, compoundInterest;
printf("Enter the principal amount: ");
scanf("%lf", &principal);
printf("Enter the annual interest rate (in %%): ");
scanf("%lf", &rate);
printf("Enter the time period in years: ");
scanf("%lf", &time);
simpleInterest = (principal * rate * time) / 100;
compoundInterest = principal * pow((1 + rate / 100), time) - principal;
printf("Simple Interest = %.2lf\n", simpleInterest);
printf("Compound Interest = %.2lf\n", compoundInterest);
return 0;
}