Ask Question
17 February, 09:13

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).

+3
Answers (1)
  1. 17 February, 10:40
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers