Slide show

[Zmodel][slideshow]

ATM Machine using C language

/* AUTHOR : JAINISH LIMBACHIYA
 PURPOSE  : ATM MACHINE
 DATE     : 15 JULY 2020*/

#include <stdio.h>
void main(void)
{
    int i, choice;
    float cash = 0;
    char c;

    do
    {
        printf("Enter the Number to perform the transaction\n");
        printf("1. Withdrawal\n");
        printf("2. Deposit\n");
        printf("3. Check Balance\n");
        scanf("%d", &choice);
        switch (choice)
        {
        case 1:
        {
            int withdraw;
            printf("Enter Amount to withdraw\n");
            scanf("%d", &withdraw);
            if (withdraw % 100 == 0)
            {
                if (cash >= withdraw)
                {
                    cash -= withdraw;
                    printf("Amount After withdrawal of cash is %.2f\n", cash);
                }
                else
                {
                    printf("You don't have enough Amount to Withdraw.Please Deposit Amount\n");
                }
            }
            else
            {
                printf("Enter Withdrawal Amount in 100's\n");
            }
            break;
        }
        case 2:
        {
            int deposit;
            printf("Enter Amount to deposit\n");
            scanf("%d", &deposit);
            if (deposit % 100 == 0)
            {
                cash = cash + deposit;
                printf("Balance After Depositing Amount is %.2f\n", cash);
            }
            else
            {
                printf("Please Enter Amount in 100's\n");
            }
            break;
        }
        case 3:
        {
            printf("Balance in the Account is %.2f\n", cash);
            break;
        }
        default:
        {
            printf("Enter Valid Choice\n");
            break;
        }
        }
        printf("To Continue Press 'Y' else any letter\n");
        fflush(stdin);
        scanf("%c", &c);
    } while (== 'y' || c == 'Y');
    printf("Thanks for using our ATM\n");
}


OUTPUT

Enter the Number to perform the transaction 1. Withdrawal 2. Deposit 3. Check Balance 2 Enter Amount to deposit 5000 Balance After Depositing Amount is 5000.00 To Continue Press 'Y' else any letter Y Enter the Number to perform the transaction 1. Withdrawal 2. Deposit 3. Check Balance 1 Enter Amount to withdraw 2500 Amount After withdrawal of cash is 2500.00 To Continue Press 'Y' else any letter Y Enter the Number to perform the transaction 1. Withdrawal 2. Deposit 3. Check Balance 3 Balance in the Account is 2500.00 To Continue Press 'Y' else any letter


No comments: