0
Pls somebody should help with the code that will compute ATM system in C language
Using switch
4 Answers
+ 3
Please post what have you already done. Nobody here will do whole work for you, if you have specific problem ask just for it.
+ 1
Upload your trial and I or someone else will help go through it with you. It isn't that hard so give it a try first.
0
#include<stdio.h>
int main()
{
float amt,creditamt,debitamt;
char ch;
printf("Enter initial amount\n");
scanf("%f",&amt);
printf("Enter\nc for credit\nd for debit\nb for balance\n");
scanf("\n%c",&ch);
switch(ch)
{
case 'c':
printf("Enter credit amount\n");
scanf("%f",&creditamt);
amt=amt+creditamt;
printf("New Amount=%f",amt);
break;
case 'd':
printf("Enter debit amount\n");
scanf("%f",&debitamt);
if(amt>=debitamt)
{
amt=amt-debitamt;
printf("New Amount=%f",amt);
}
else
{
printf("Insufficient amount");
}
break;
case 'b':
printf("Amount in your account=%f",amt);
break;
default:
printf("Invalid input!!");
}
}
0
I want it to be more interactive