-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterest.h
41 lines (34 loc) · 941 Bytes
/
interest.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
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
typedef struct cp_int
{
float principal;
float rate;
float time;
} interest;
void int_cal()
{
interest intr;
int ch;
float compound;
float simple;
printf("Enter the Amount\n");
scanf("%f",&intr.principal);
printf("Enter the Rate\n");
scanf("%f",&intr.rate);
printf("Enter the Time\n");
scanf("%f",&intr.time);
printf("Choose the below options to proceed further.\n 1. Simple Intrest for Current Balance\n 2. Compound Intrest for Fixed Deposit \n");
scanf("%d", &ch);
switch(ch)
{
case 1: simple=(intr.principal*6*intr.rate)/100;
printf("Simple Intrest %f", simple);
break;
case 2: compound=intr.principal*pow(1+intr.rate/100,intr.time)-intr.principal;
printf("Compound Interest %f", compound);
break;
default: printf("Invalid");
}
}