Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an atm program and the associated Makefile, which is an ATM simulated: The

ID: 3920703 • Letter: W

Question

Write an atm program and the associated Makefile, which is an ATM
simulated: The desired amount is read from the standard input. The maximum payout amount
is 2000 EUR, there are any number of bills of 5, 10, 20 and 50 EUR to
Available. For payout the minimum possible number of bills should be used
starts with the biggest notes. The output should be in the form
Quantity1 * Schein1-EUR Quantity2 * Schein2-EUR ...

To solve this task you need the following basic knowledge:
• Write a main () function
• Write a makefile
• Control flow (if) in C
• Functions in C
• Reading keystrokes
• Using gcc

Eingabe Ausgabe 42 10000 0 0 1*5-EUR 1*50-EUR 1*10-EUR 1*5-EUR 65

Explanation / Answer

#include<stdio.h>


void display(int c50,int c20,int c10,int c5){

        if (c50 > 0)
           printf("%d*50-EUR ",c50);
        if (c20 > 0)
           printf("%d*20-EUR ",c20);
        if (c10 > 0)
           printf("%d*10-EUR ",c10);
        if (c5 > 0)
           printf("%d*5-EUR ",c5);
        printf(" ");
}

int main(){

   printf("Enter an amount:");
   int n;
   scanf("%d",&n);
   if (n > 2000 || n < 50){
      printf("0 ");
   }
   else {
        int c50 = n / 50;
        n = n % 50;
        int c20 = n / 20;
        n = n % 20;
        int c10 = n / 10;
        n = n % 10;
        int c5 = n / 5;
        n = n % 5;

        display(c50,c20,c10,c5);


   }
   return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote