Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int balance=0,tempPin;
- int pin= 12345;
- int anotherTransaction=1;
- printf(" Please enter your pin:");
- scanf("%d",&tempPin);
- if(pin!=tempPin)
- {
- printf("\n Invalid pin.");
- return 0;
- }
- while(anotherTransaction==1)
- {
- int choice;
- printf("----------------------------------------------------\n");
- printf(" Welcome To ATM Service\n");
- printf(" 1- Check balance\n");
- printf(" 2- Diposit cash\n");
- printf(" 3- Withdraw cash\n");
- printf("----------------------------------------------------\n\n");
- printf("enter your choice: ");
- scanf("%d",&choice);
- if(choice==1){//check balance
- printf("your balance is: $%d\n",balance);
- }
- else if(choice==2){
- int amountDeposit;
- printf("enter the amount to deposit: $");
- scanf("%d",&amountDeposit);
- balance=balance+amountDeposit;
- }
- else if(choice==3){
- int amountWithdraw;
- printf("Enter the amount to withdraw: $");
- scanf("%d",&amountWithdraw);
- balance=balance-amountWithdraw;
- }
- else{
- printf("Invalid transaction.\n");
- }
- anotherTransaction=0;
- while(anotherTransaction!=1 && anotherTransaction!=2)
- {
- printf("do you want to do another transaction:\n");
- printf("1- Yes, 2- No\n");
- scanf("%d",&anotherTransaction);
- }
- if (anotherTransaction==2){
- printf("_______________thanks for using_______________");
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement