Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Shavit Borisov
- // CW
- import java.util.Scanner;
- public class ThreeDigitNumber {
- public static void main(String[] args)
- {
- Scanner in = new Scanner (System.in);
- int num, hundreds, tens, ones;
- System.out.println("Enter a 3 digit number:");
- num = Math.abs(in.nextInt());
- hundreds = num / 100;
- tens = num % 100 / 10;
- ones = num % 100 % 10;
- System.out.println("The order of the digits is: " + hundreds + ", " + tens + ", " + ones + ".");
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment