1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

c program for ATM

Discussion in 'C' started by paverma0, Nov 6, 2011.

  1. paverma0

    paverma0 New Member

    Joined:
    Nov 6, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    #include<stdio.h>
    #include<conio.h>
    #include<stdlib.h>
    
    void main()
    {
    
    char name[25]= { 'p','a','n','k','a','j' };
    int pin, temp_pin;
    int ch;
    float bal_amount, withd_amount;
    
    
    
    
    	printf("Welcome to SBI ATM\n");
    	printf("------------------\n\n\n");
    	printf("HELLO : %s\n\n\n",name);
    	printf("\t\tMain Menu \n\n\n");
    	printf("1. Withdrawl\t\t");
    	printf("2. Change Pin\n");
    	printf("3. Balance Enquiry\t");
    	printf("4. Exit\n\n\n");
    	printf("Please Enter Your Pin\n");
    	scanf("%d",&temp_pin);
    	printf("\n\n\n");
    	printf("Enter your choice");
    	scanf("%d",&ch);
    	if(temp_pin==pin)
    	{
    		switch(ch)
    			case 1: printf("enter amount\n");
    					if(withd_amount<=bal_amount)
    					{
    						bal_amount=bal_amount-withd_amount;
    					printf("Your balance amount is Rs. %f",bal_amount);
    					}
    					else
    					{
    					printf("insufficient balance in account\n");
    					}
    					break;
    			case 2: printf("please enter old pin\n");
    					scanf("%d",temp_pin);
    					if(temp_pin==pin)
    					{
    						printf("enter new pin\n");
    						scanf("%d",temp_pin);
    						pin=temp_pin;
    						printf("pin changed successfully\n");
    					}
    					else
    					{
    						printf("please enter correct pin\n");
    					}
    		
    					break;
    			case 3: printf("total amount in your account is Rs. %f\n"bal_amount);
    					break;
    			case 4: printf("thank you for visiting us \n come again\n");
    					break;
    
    			case default:
    				printf("please enter correct choice\n");
    		
    
    	}
    	else
    		printf("enter the correct pin\n");
    
    
    
    getch();
    
    
    }
     

Share This Page