ADVANCE PROGRAMMING IN C
HOW TO MAKE ATM MACHINE PROGRAMMING IN C
/*
* program to display c program
*/
#include <stdio.h>
usingned long amount=1000, deposit, withdrawal;
int choice transaction =’y”
void main()
{
while(pin != 1520)
{
printf(“ENTER YOUR PIN:”);
scanf(“%d”, &pin);
if (pin != 1520)
printf(“PLEASE ENTER VALID PASSWORDn”);
}
do
{
printf(“******WELCOME TO ATM********n”);
printf(“1. check balancen”);
printf(“2. withdrawl cashn”);
printf(“3. deposit cashn”);
printf(“4. quitn”);
printf(“**********************?*****************nn”);
printf(“enter your choicen”);
scanf(“%d”, &choice);
switch (choice)
{
case 1:
printf(“n YOUR BALANCE IN rs : %lu “,amount);
break;
case2;
printf(n enter the amount to withdraw: “);
scanf(“%lu”, &withdrawl);
if (withdraw % 100 !=0)
{
printf(“n please enter the amount in multiple of hundred”);
}
else if (withdrawl>(amount – 500))
{
printf(“n insufficient balance”);
}
else
{
amount = amount – withdrawl;
printf(“nn please collect your cash”);
printf(n your current balance is%lu”, amount);
}
break;
3:
printf(“n ENTER THE AMOUNT TO DEPOSIT”);
scanf(“%lu”, &deposit);
amount = amount + deposit;
printf(“YOUR BALANCE IS %lu”,amount);
break;
default:
printf(“INVALID CHOICE”);
}
printf(“nnn DO YOU WANT ANOTHER TRANSACTION?(y/n)’ n”);
fflush(stdin);
scanf(“%c”, &transaction);
if (transaction == ‘n’ || transaction == ‘N’)
k = 1;
} while (!k);
printf(“nn THANKS FOR BANKING WITH US “);
}