| Current Path : /var/www/html/bibhas.ghoshal/ITP_2019/lab/ |
| Current File : /var/www/html/bibhas.ghoshal/ITP_2019/lab/prog12.c |
#define USER_PIN 7534
#include<stdio.h>
int main(void)
{
int atm_pin,amount;
while (1) { /*Block 1 begins */
printf("Enter PIN: ");
scanf("%d", &atm_pin);
if (atm_pin == 0)
printf("PIN can't be zero.\n");
else if (atm_pin > 9999)
printf("PIN should not be more than 4 characters.\n");
else if (atm_pin < 1000)
printf("PIN should not be less than 4 characters.\n");
else if (atm_pin != USER_PIN)
printf("Incorrect PIN.\n");
else { /*Block 2 begins */
printf("Enter amount to withdraw: ");
scanf("%d",&amount);
if (amount > 20000)
printf("Can't withdraw more than Rs 20000.\n");
else if (amount == 0)
return 1;
else { /*Block 3 begins */
printf("Processing transaction, take cash.\n");
return 0;
} /* Block 3 ends */
} /* Block 2 ends */
} /* while loop ends */
return 0; /* Wil this statement ever be executed? */
}