Read This Program Click Here๐๐
This program is application of ATM machine.ATM machine c program given below.This Program Shows ATM MACHINE
Transmission And Working let's You Enjoy This Program
ATM MACHINE
#include<stdio.h> main() { int i,choice; float cash=0; char c; do{ printf("Enter\n1-Withdraw\n2-Deposit\n3-Check Balance\n"); scanf("%d",&choice); switch(choice) { case 1: { int withdraw; printf("Enter Amount to withdraw\n"); scanf("%d",&withdraw); if(withdraw%100==0) { if(cash>=withdraw) { cash-=withdraw; printf("Amount After withdrawl of cash is %f\n",cash); } else { printf("You don't have enough Amount to Withdraw.Please Deposit Amount\n"); } } else { printf("Enter Withdrawl Amount in 100's\n"); } break; } case 2: { int deposit; printf("Enter Amount to deposit\n"); scanf("%d",&deposit); if(deposit%100==0) { cash=cash+deposit; printf("Balance After Depositing Amount is %f\n",cash); } else { printf("Please Enter Amount in 100's\n"); } break; } case 3: { printf("Balance in the Account is %.2f\n",cash); break; } default : { printf("Enter Valid Choice\n"); break; } } printf("To Continue Press 'Y' else any letter\n"); fflush(stdin); scanf("%c",&c); }while(c=='y' || c=='Y'); printf("Thanks for using our ATM\n"); }
Enter 1-Withdraw 2-Deposit 3-Check Balance 1 Enter Amount to withdraw 120 Enter Withdrawl Amount in 100's To Continue Press 'Y' else any letter Y Enter 1-Withdraw 2-Deposit 3-Check Balance 2 Enter Amount to deposit 1200 Balance After Depositing Amount is 1200.000000 To Continue Press 'Y' else any letter Y Enter 1-Withdraw 2-Deposit 3-Check Balance 1 Enter Amount to withdraw 1250 Enter Withdrawl Amount in 100's To Continue Press 'Y' else any letter Y Enter 1-Withdraw 2-Deposit 3-Check Balance 1 Enter Amount to withdraw 300 Amount After withdrawl of cash is 900.000000 To Continue Press 'Y' else any letter Y Enter 1-Withdraw 2-Deposit 3-Check Balance 3 Balance in the Account is 900.00 To Continue Press 'Y' else any letter Y Enter 1-Withdraw 2-Deposit 3-Check Balance 5 Enter Valid Choice To Continue Press 'Y' else any letter N Thanks for using our ATM
Explanation:
- This program starts with initializing :
- i,c → used as helping variable
- choice→ To choose options
- cash→To store final money by default is zero
- i,c → used as helping variable
- Now Lets us Choose Option 2 to deposit money of 2000 rupees
int deposit; printf("Enter Amount to deposit\n"); scanf("%d",&deposit); if(deposit%100==0) { cash=cash+deposit; printf("Balance After Depositing Amount is %f\n",cash); } else { printf("Please Enter Amount in 100's\n"); }
This is the logic for option 2.Now we need to add deposit amount and this is stored in variable "deposit".Now we are checking whether depositing amount is in multiple of 100's or not.Only if the amount that is deposited in multiples of 100's to avoid 50' and 10's etcif(deposit%100==0)
To check whether deposited amount is in 100;s we are checking it as given above.Then we are adding "deposit" to "cash".Now cash=2000 as we enetered deposit amount as 2000. - If the deposit amount is not in 100's it will throw an error to Enter Amount in 100's
- Now lets choose option 1 to withdraw money of 2300 and now cash is having 2000 rupees
if(withdraw%100==0) { if(cash>=withdraw) { cash-=withdraw; printf("Amount After withdrawl of cash is %f\n",cash); } else { printf("You don't have enough Amount to Withdraw.Please Deposit Amount\n"); } } else { printf("Enter Withdrawl Amount in 100's\n"); }
First of all we are checking if withdrwl amount is multiples of 100 or not and as 2300 is multiple of 100 then we are checking if cash>=withdrawlamount .In this case 2000 is not greater than 2000 so it will throw an error saying "You don't have enough Amount to Withdraw.Please Deposit Amount" - Now lets withdraw 1800 so withdraw=1800.Now again we are checking 1800 is multiples of 100 or not ans as it is multiple of 100 we are going to check whether 2000>1800 (cash>=withdraw) and as it is true we are reducing withdraw amount from cash. So Now cash=2000-1800=200
printf("Balance in the Account is %.2f\n",cash);
Finally displaying balance which is option 3
- And all this will be in do while loop so that user can continue to do transactions like withdraw and deposit until he stops using
do{ ............... ................ ................. ................. ................. ................. printf("To Continue Press 'Y' else any letter\n"); fflush(stdin); scanf("%c",&c); }while(c=='y' || c=='Y');
so if user chooses other than 'y' he will go out of this loop else continues to do transactions - Finally after finishing his/her transactions we are greeting with
printf("Thanks for using our ATM\n");
Thanks for reading.
Hack and take money directly from any ATM Machine Vault with the use of ATM
ReplyDeleteProgrammed Card which runs in automatic mode. email
oscarwhitehackersworld@gmail.com
whatsapp..+1(510)-777-9243 or call/Text him +1(510)-984-6924