-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsidh.h
51 lines (51 loc) · 1.2 KB
/
sidh.h
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
void clear()
{
fflush(stdin);
}
int gfloat()
{
float p;
int value = 1;
while (value == 1) //Loop for checking numeric or alphabetic input
{
clear();
scanf("%f", &p);
if (p)
{
return p;
break;
}
else
{
printf("Please enter a numeric value\n");
}
}
}
void si()
{
float p, r, t, smi;
printf("\nEnter the total amount\n");
p = gfloat();
printf("Enter the rate of interest\n");
r = gfloat();
printf("Enter the total time in year\n");
t = gfloat();
smi = (p * r * t) / 100;
printf("simple interest: %.2f\n", smi);
printf("Amount with interest: %.2f\n\n", smi + p);
}
void ci()
{
float cmi, p, r, t, n;
printf("\nEnter the total amount\n");
p = gfloat();
printf("Enter the rate of interest\n");
r = gfloat();
printf("Enter the total time in year\n");
t = gfloat();
printf("How many times interest compounded per year\n");
n = gfloat();
cmi = p * pow((1 + r / (100 * n)), n * t);
printf("Compounded interest: %.2f\n", cmi - p);
printf("Amount with interest: %.2f\n\n", cmi);
}