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

Respuesta :

Answer:

Explanation:

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");

ACCESS MORE
EDU ACCESS
Universidad de Mexico