Create the logic (pseudocode and diagram) for a program that continuously prompt
ID: 3693826 • Letter: C
Question
Create the logic (pseudocode and diagram) for a program that continuously prompts the user for a number of dollars until the user enters 0. Pass each entered amount to a conversion method that displays a breakdown of the passed amount into the fewest bills; in other words, the method calculates the number of 20s, 10s, 5s, and 1s needed.
Note: I am in programming logic and design (intro to programming). I don't know any programming languages. It is a basic intro course. Please include the actual diagrams so that I can see the correct layout and include proper spacing in the pseudocode, PLEASE!!
Explanation / Answer
I'll give a simple algorithm for this -
step 1:
start a loop: which runs until input =0
step 2:
Divide the input by 20, dividend =k1, remainder =r1
Divide the input by r1, dividend = k2, remainder = r2
Divide the remainder r2 by 5, dividend = k3, remainder = r3
Divide remainder r3 by 1, dividend k4
Print ( " No of Rs 20 bills = " + k1)
Print ( " No of Rs 10 bills = " + k2)
Print ( " No of Rs 5 bills = " + k3)
Print ( " No of Rs 1 bills = " + k4)
Keep repeating step 1 till user inputs 0.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.