-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATM.c
More file actions
32 lines (29 loc) · 741 Bytes
/
Copy pathATM.c
File metadata and controls
32 lines (29 loc) · 741 Bytes
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
#include<stdio.h>
int main()
{
char ch;
ch = printf("Choose\n C for Credit\n D for Debit\n B for Balance\n");
scanf("%c",&ch);
int c,d,b,i;
printf("Enter the amount: ");
scanf("%d",&i);
switch(ch)
{
case 'C':
printf("Enter the amount to be credited: ");
scanf("%d",&c);
printf("Your new balance is %d",i+c);
break;
case 'D':
printf("Enter the amount to be debited: ");
scanf("%d",&d);
printf("Your new balance is %d",i-d);
break;
case 'B':
printf("Your balance is %d",i);
break;
default:
printf("No case matched!");
}
return 0;
}