Thursday, September 5, 2019

#include<stdio.h>
int main()
{   int cp,pin;
    int a,add,option,with;
    printf("                WELCOME IN THIS ATM                \n\n");
    printf(" \nAt first you create a pin to secure your accout\n");
    scanf("%d",&cp);
    printf(" Thank you to create pin \n");
start:
    printf(" Enter pin  ");
    scanf("%d",&pin);
    if(pin==cp)
    {
        printf(" \n\nAdd some money because this is first time  ");
        scanf("%d",&a);
        do
        {   printf(" \n This is your home screen \n");
            printf("\n1. balance enquiry \n2. add money \n3. money withdraw \n4. exit \n5. Out this Program \n ");
            scanf("%d",&option);
            switch(option)
            {
                case 1:{
                    printf("\n Your balance is %d ",a);
                    break;
                }
                case 2:{
                    printf("\n Add money = ");
                    scanf("%d",&add);
                    a=a+add;
                    printf(" \nNow your current balance is %d ",a);
                    break;
                }
                case 3:{
                    printf(" \Enter money to withdraw ");
                    scanf("%d",&with);
                    if(with>a)
                        printf("\n You have no sufficient money for withdraw ");
                    else
                    {
                        a=a-with;
                        printf("\n Now you receive %d rupess and now your current balance is %d ",with,a);
                    }
                    break;
                }
                case 4:
                    goto start;
                case 5: goto end;
                    
                default: printf("\n choose the uper option \n");
            }
            
        }while(option<4);
    }
    else
    {
        printf("\n you enter a wrong pin so try it \n");
        goto start;
        
    }
end:
    return 0;
}

No comments:

ATM Program by Anupam Guin

#include<stdio.h> int main() { int cp,pin; int a,add,option,with; printf(" WELCOME IN THIS ATM ...