Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Triacontakai_Change {
- public static void main(String[]args){
- Scanner monscan = new Scanner(System.in);
- System.out.println("Enter change in cents: ");
- int c = monscan.nextInt(); //c = change left
- System.out.println("Here are your coins: ");
- int q = c/25;
- c = c-(q*25);
- int d = c/10;
- c = c-(d*10);
- int n = c/5;
- int p = c-(n*5);
- System.out.println("Quarters: "+ q);
- System.out.println("Dimes: "+ d);
- System.out.println("Nickels: "+ n);
- System.out.println("Pennies: "+ p);
- int t = q+d+n+p;
- System.out.println("Total coins: "+ t);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement