Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch4ex6;
- import java.util.Scanner;
- public class Ch4Ex6
- {
- public static void main(String[] args)
- {
- Scanner sc=new Scanner(System.in);
- int total;
- System.out.println("Enter the change in cents: ");
- total=sc.nextInt();
- System.out.println("The minimum number of coins is:");
- int q=total/25;
- total=total%25;
- System.out.println("Quarters: "+q);
- int d=total/10;
- total=total%10;
- System.out.println("Dimes: "+d);
- int n=total/5;
- total=total%5;
- System.out.println("Nickles: "+n);
- System.out.println("Pennies: "+total);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement