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

+4
Answers (1)
  1. 19 January, 03:13
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers