/* UsingMod.java : using the Mod function to break up a number */ public class usingMod { public static void main ( String[] args) { int x = 1234 ; int x_saved = x; int a,b,c,d; d = x / 1000; x = x %1000; c = x / 100; x = x % 100; b = x / 10; a = x % 10; System.out.println("The original number (stored as x_saved) is: " + x_saved); System.out.println("Thousands: " + d); System.out.println("Hundreds: " + c); System.out.println("Tens: " + b); System.out.println("Ones: " + a); System.out.println("When this program is done, x is equal to "+x); System.exit(0); } }