-
Notifications
You must be signed in to change notification settings - Fork 121
/
atm.c
57 lines (50 loc) · 1.66 KB
/
atm.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <stdio.h>
int main(){
float total_amount,transfer,deposite,withdraw,cheak_balance;
int pin,password,user_input;
printf("Create your PIN to enter in your account\n");
scanf("%d", &password);
printf("Enter the starting amount to enter in account\n");
scanf("%f", &total_amount);
printf("1.) Check balance.\n2.) Deposite\n3.) Withdraw.\n4.) Transfer.\n");
scanf("%d", &user_input);
printf("Enter pin\n");
scanf("%d", &pin);
if (pin==password)
{
switch (user_input)
{
case 1:
printf("Your total balance in your account is %f", total_amount);
break;
case 2:
printf("Enter amount to deposite\n");
scanf("%f", &deposite);
float net_balance_after;
net_balance_after = total_amount + deposite;
printf("Net balance after deposite is %f", net_balance_after);
break;
case 3:
printf("Enter amount to withdraw\n");
scanf("%f", &withdraw);
float balance_after_withdraw;
balance_after_withdraw = total_amount - withdraw;
printf("Net balance after withdraw %f", balance_after_withdraw);
break;
case 4:
printf("Enter amount to tranfer\n");
scanf("%f", &transfer);
float balance_after_transfer;
balance_after_transfer = total_amount - transfer;
printf("Net balance after transfer is %f", balance_after_transfer);
break;
default:
printf("Enter valid user input");
break;
}
}
else
{
printf("Your password is wrong. so repeat process again");
}
}