Ask Question
12 May, 10:45

You are to write a program that will input a number between 1 and 99. The number will represent the change from a transaction. Your program will take the change and output the least amount of coin possible. You can assume that there are 50 cent, 25 cent, 10 cent, 5 cent and 1 cent coins (halves, quarters, dimes, nickels, and pennies).

+1
Answers (1)
  1. 12 May, 13:09
    0
    public class Exercise50 {

    public static void main (String args[]) {

    System. out. println ("/nDivided by 3: ");

    for (int i=1; i<100; i++) {

    if (i%3==0)

    System. out. print (i + ", ");

    }

    System. out. println ("/n/nDivided by 5: ");

    for (int i=1; i<100; i++) {

    if (i%5==0) System. out. print (i + ", ");

    }

    System. out. println ("/n/nDivided by 3 & 5: ");

    for (int i=1; i<100; i++) {

    if (i%3==0 && i%5==0) System. out. print (i + ", ");

    }

    System. out. println ("/n");
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “You are to write a program that will input a number between 1 and 99. The number will represent the change from a transaction. Your program ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers