Contact Learn C
Copy

Program 278: Program for ATM Machine

Program 278: Program for 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");
}
Explanation:

  1. This program starts with initializing :
    • i,c → used as helping variable
    • choice→ To choose options
    • cashTo store final money by default is zero
  2. 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 etc
    if(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.
  3. If the deposit amount is not in 100's it will throw an error to Enter Amount in 100's


  4. 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>=withdrawl amount .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"
  5. 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
  6.  printf("Balance in the Account is %.2f\n",cash);
  7. Finally displaying balance which is option 3
  8. 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 
  9. Finally after finishing his/her transactions we are greeting with
  10.    printf("Thanks for using our ATM\n");

Output:
Program for ATM Machine

Program for ATM Machine






10 comments:

  1. Thank you, this information is so helpful

    ReplyDelete
    Replies
    1. iI’m lauriel from New York, United States. I lost my job a few months back after my divorce with my wife. I tried everything positive to make sure I took good care of my kids but all failed, and I was in debt which makes everything worse. I was kicked out of my home and i had to live with my neighbor after pleading with her to allow me to stay with her for some days while I figured out how to get a home which she agreed to, but no one was willing to help anymore. I bumped into this page from google and I was excited about this, then I contacted the hackersBill Dean. I had just $200, so I pleaded with them to help me because of my condition but they never accepted. I believed in this, so I managed to pawn a few things and got $500. I ordered the $10,000 card and I got my card delivered to me by Ups 4 days later. I never believed my eyes! I was excited and upset as well, I managed to withdraw $2000 on the ATM and $2500 the second day. I went to Walmart and a grocery store and bought a couple of things for $3000. The card got blocked the third day and I contacted them and I was told it's a mistake from my end. I’m so happy, I have started all over again and have a good apartment with my kids you can contact him through is via email (globalatmcardhackingservices@gmail.com)or his whatsap contact (+1 301-887-5071) 

      Delete
  2. so helpful!! thank you but what abiut pin number .....

    ReplyDelete
  3. I am very happy, I'm a living testimony. I got my blank ATM card last week from Jim Lee hackers. At first when I was in doubt. Then I decided to give it a trial and to my surprise the card was delivered, I went testing it on the ATM machine. I was shocked when I used it to withdraw $1500 and now I have withdrawn $20,000 in total. The card is real, I'm so happy thank you Jim Lee hackers. If interested you can email: jimleehacker07@gmail.com

    ReplyDelete
  4. Hi there I am so delighted I found your weblog, I really found you by accident,
    while I was researching on Bing for something else, Regardless I am here now and would just QUALITY UNDETECTED ORIGINAL FAKE DRIVING LICENCE like to say thank you for a fantastic post and a all round entertaining blog (I also love the theme/design), I don’t have time to go through it all at the minute but I have bookmarked it and also added your RSS feeds, so when I have time I will be back to read a lot more, Please do keep up the excellent job.

    ReplyDelete
  5. Have you pay your necessary BILLS? Do you need money? Do you want a better way to transform your own life? My name his Elizabeth Maxwell. I am here to share with you about Mr OSCAR WHITE new system of making others rich with not less than two to three days.I was in search of a job opportunity on the internet when i come across his aid on a blogs that i was on to, talking on how he can help the needy with a programmed BLANK ATM CARD.I thought it was a scam or normal gist but i never had a choice than to contact him cause i was seriously in need of Finance for Business.I contacted him on the CARD, and not less than a minute he respond and give me the necessary information’s on how to get the card. My friends, today am a sweet happy woman with good business and a happy family. I charge you not to live by ignorance.Try and get an ATM card today through (MR OSCAR WHITE)and be among the lucky ones who are benefiting from this card. This ATM card is capable of hacking into any ATM machine anywhere in the world.It has really changed my life and now I can say I’m rich because I am a living testimony. The less money I get in a day with this card is $15,000.Every now and then money keep pumping into my account. Although is illegal, there is no risk of being caught, as it is programmed so that it can not trace you, but also has a technique that makes it impossible for the CCTV to detect you.. I urge you to contact him on the BLANK ATM CARD. For details on how to get yours today, email hackers oscarwhitehackersworld@gmail.com ,whats-app +1(209)-643-1515

    ReplyDelete
  6. I am a widow with two kids, i want to share my testimony on how i paid all my debts and own myself a business.
    I went online then i came across a testimony about a blank card, i decided to give it a trial, all to my surprise it came through. i got the card, each day i withdraw $ 2000 and i have withdrawn the total of $ 80000.
    i am so thankful and grateful to Wesley mark hackers whom God used to take me out of debts and poverty
    i am sharing this because i know so many out there are in need do not doubt, i can guarantee you the best with Wesley Mark hackers, if interested email him on wesleymarkhackers@gmail.com
    whatsapp no: +1 (928) 2727056

    ReplyDelete
  7. China JIALITE is one of the leading Automatic pre-coating laminating machine, Water Base Oil Coating Machine, automatic coating machine Manufacturers,Factory and Suppliers, Our product quality has passed international certification, and the price is affordable, welcome to call and order our products wholesale. High Speed Automatic Vertical Laminating Machine

    ReplyDelete
  8. HAVE YOU LOST YOUR MONEY TO BINARY OPTION SCAM OR ANY ONLINE SCAM WHATSOEVER?.DO YOUR DESIRE CREDIT REPAIR[EQUIFAX, EXPERIAN, TRANSUNION? WELL, YOU HAVE FOUND REDEMPTION.


    BEWARE OF FRAUDSTERS looking to hoax.
    if you have been a VICTIM, contactEmail:creditcards.creditscoreupgrade@gmail.com
    whatsapp:+1(437) 536-6082 for directives.
    Here, it's always a win for you.

    ��OUR SERVICES��
    ∆Binary Option funds recovery
    ∆Social media hack
    ∆Recovery of loan scam
    ∆Credit repair (Equifax,Experian,Transunion)
    ∆Email hack
    ∆College score upgrade
    ∆Android & iPhone Hack
    ∆Website design
    ∆Website hack
    ∆And lots more.
    We have specially programmed ATMs that can be used to withdraw money at ATMs, shops and points of sale. We sell these cards to all our customers and interested buyers all over the world, the cards have a withdrawal limit every week.

    CONTACT INFO:
    Email:creditcards.creditscoreupgrade@gmail.com
    whatsapp:+1(437) 536-6082
    Copyright ©️ 2022.

    ReplyDelete
  9. Hack and take money directly from any ATM Machine Vault with the use of ATM
    Programmed Card which runs in automatic mode. email
    oscarwhitehackersworld@gmail.com
    whatsapp..+1(510)-777-9243

    ReplyDelete

Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide