Bank ATM Menu System using Switch Dry Run in C

Bank ATM Menu System using Switch is an interactive C dry run visualizer from the Switch programs section. Study the source code, then use the execution controls to follow each step, variable update, highlighted line, and console output.

This page provides a browser-based dry run with source-code highlighting, auto-scroll, voice narration controls, and execution output for learning the program step by step.

Bank ATM Menu System using Switch Program Code

#include <stdio.h>

void show_menu() {
    printf("\n=== ATM MENU ===\n");
    printf("1. Check Balance\n");
    printf("2. Deposit Money\n");
    printf("3. Withdraw Money\n");
    printf("4. Transfer Funds\n");
    printf("5. Exit\n");
    printf("Enter your choice: ");
}

int main() {
    int choice;
    float amount;
    float balance = 1000.0; // Initial account balance
    
    do {
        show_menu();
        scanf("%d", &choice);
        
        switch(choice) {
            case 1: // Check Balance
                printf("Current Balance: $%.2f\n", balance);
                break;
                
            case 2: // Deposit
                printf("Enter amount to deposit: ");
                scanf("%f", &amount);
                if(amount > 0) {
                    balance += amount;
                    printf("Deposited $%.2f. New balance: $%.2f\n", 
                           amount, balance);
                } else {
                    printf("Invalid amount!\n");
                }
                break;
                
            case 3: // Withdraw
                printf("Enter amount to withdraw: ");
                scanf("%f", &amount);
                if(amount > 0 && amount <= balance) {
                    balance -= amount;
                    printf("Withdrew $%.2f. New balance: $%.2f\n", 
                           amount, balance);
                } else {
                    printf("Invalid amount or insufficient funds!\n");
                }
                break;
                
            case 4: // Transfer
                printf("Transfer feature coming soon!\n");
                break;
                
            case 5: // Exit
                printf("Thank you for banking with us!\n");
                break;
                
            default:
                printf("Invalid choice! Please try again.\n");
        }
        
    } while(choice != 5);
    
    return 0;
}

View the complete Switch programs page.

Program Console Bank ATM Menu System using Switch Topic: C Vignaankosh.com
Execution Panel
Step 0/0
Console is empty.