Question: Draw the flowchart for the following code: #include #include //declare float float amount=10000; float deposit, withdraw; char transaction; int choice; int pin; int k; void
Draw the flowchart for the following code:
#include
void main() { while (pin != 1234) { printf("Please enter your pin number:"); scanf("%d", &pin); if (pin != 1234) printf("Please enter a valid password: "); } atm_service(); printf(" Thanks for using our service"); } int atm_service() { printf("********Welcome to our bank ATM Service************** "); printf("1. Check Balance "); printf("2. Withdraw Cash "); printf("3. Deposit Cash "); printf("4. Quit "); printf("*********************************************** "); printf("Enter your choice: "); scanf("%d", &choice);
while (choice== 1 || choice==2 || choice==3 || choice==4) { switch (choice) { case 1: printf(" In your balance account, you have: %.3f OMR", amount); printf(" Do you wish to do another operation?(y/n): "); scanf(" %c", &transaction); if (transaction == 'y'|| transaction == 'Y') { return atm_service(); } else { choice = 5; break; } case 2: printf(" Enter the amount you want to withdraw: "); scanf("%f", &withdraw); amount = amount - withdraw; printf(" Please collect your money"); printf(" In your balance account, you have: %.3f OMR", amount); printf(" Do you wish to do another operation?(y/n): "); scanf(" %c", &transaction); if (transaction == 'y'|| transaction == 'Y') { return atm_service(); } else { choice = 5; break; } case 3: printf(" Enter the amount you want to deposit: "); scanf("%f", &deposit); amount = amount + deposit; printf("In your balance account, you have: %.3f OMR", amount); printf(" Do you wish to do another operation?(y/n): "); scanf(" %c", &transaction); if (transaction == 'y'|| transaction == 'Y') { return atm_service(); } else { choice = 5; break; } case 4: choice = 5; break; } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
