-
Notifications
You must be signed in to change notification settings - Fork 92
/
ATM.c
44 lines (40 loc) · 1016 Bytes
/
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
#include <stdio.h>
int main()
{
float B, Cr, Dr, Net;
int cmd;
// Enter the balance to open the account
printf("Account Opening Balance : ");
scanf("%f", &B);
// Transaction Options
printf("\n[1] Credit Balance");
printf("\n[2] Debit Balance");
printf("\n[3] Balance Enquiry\n");
// Select Transaction Option
printf("\nSelect Option : ");
scanf(" %d", &cmd);
switch(cmd)
{
// Credit Balance
case 1:
printf("Enter Amount : ");
scanf("%f",&Cr);
Net = B+Cr;
printf("\nCurrent Balance : %f", Net);
break;
// Debit Balance
case 2:
printf("\nEnter Amount : ");
scanf("%f",&Dr);
Net = B-Dr;
printf("\nCurrent Balance : %f", Net);
break;
// Balance Enquiry
case 3:
Net = B;
printf("Available Balance : %f", Net);
break;
default : printf("Transaction Cancelled!");
}
return 0;
}