Wednesday, 17 January 2018

HOW ATM MACHINE WORKS (A prototype code in C language)





#include <stdio.h>

#include <conio.h>



main()

{

l3:

int amount[3]{1000,2000,3000};

int code[3]{1234,2134,5555};

int c,i,index=-1,input;

l1:

printf("Enter the Code: ");

scanf("%d",&c);



for(i=0;i<3;i++)

{



if(c==code[i])

{

index=i;

}





}



if(index==-1)

{

printf("\nINVALID CODE.......\nEnter the code again........\n");

goto l1;

}

l2:

printf("\n-------------------------------------\n");

printf("\t\twelcome to ATM");

printf("\n-------------------------------------\n");

printf("press 1 for Deposite Amount---->\n");

printf("press 2 for Cash With Drawl---->\n");

printf("press 3 for Check Balance---->\n");

scanf("%d",&input);



switch(input)

{



case 1:

printf("Enter the amount that you want to deposite : ");

int deposite;

scanf("%d",&deposite);

amount[index]=amount[index]+deposite;

printf("%d credited in your account %d \n",deposite,&amount[index]);

break;





case 2:

printf("Enter the amount that you want to draw : ");

int draw;

scanf("%d",&draw);

if(draw>amount[index])

{

printf("YOU ARE EXCEEDING YOUR BALANCE AMOUNT......\n");

}

else{



amount[index]=amount[index]-draw;

printf("%d credited in your account %d \n",draw,&amount[index]);

}

break;





case 3:

printf("Your Balance Amount is %d",amount[index]);

break;



default:





break;



}





printf("\nDo you want to Continue.....(y/n)\n");

char e;

e=getchar();

scanf("%c",&e);

if(e=='y')

{

goto l2;

}

else

{

index=-1;

goto l3;

}



}

No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...