forked from ShreeyansB/C-Programs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Banking.c
42 lines (42 loc) · 1.25 KB
/
Banking.c
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
#include<stdio.h>
#include<stdlib.h>
void main()
{
float bal=100000,interest,amount;
float p,r,t; //For Simple Interest
char inp = '0';
while (inp != 10000)
{
printf("\n$$$$$$$$$$$$$$$$$$$$\n1. Deposit Amount\n2. Withdraw Amount\n3. Calculate Interest\n4. View Balance\n(Type X to exit)\n$$$$$$$$$$$$$$$$$$$$\n\n");
scanf(" %c", &inp);
switch (inp)
{
case '1':
printf("Enter Amount: ");
scanf("%f", &amount);
bal = bal + amount;
break;
case '2':
printf("Enter Amount: ");
scanf("%f", &amount);
bal = bal - amount;
break;
case '3':
printf("Enter principal,rate and time period: ");
scanf("%f %f %f",&p,&r,&t);
interest = (p*r*t)/100;
printf("Interest is %f\n", interest);
break;
case '4':
printf("Balance: %f\n", bal);
break;
case 'X':
printf("Exiting...");
exit(0);
break;
default:
printf("Invalid Input\n");
break;
}
}
}