//Import Scanner
import java.util.Scanner; public class SeperateDigit { public static void main(String[] args) { //Scanner Scanner sc = new Scanner(System.in); System.out.print("Please enter the five numbers interger (00000-99999): "); //insert five number interger. int Inter = sc.nextInt(); int Dig1 = Inter / 10000; int Dig2 = Inter % 10000 / 1000; int Dig3 = Inter % 1000 / 100; int Dig4 = Inter % 100 / 10; int Dig5 = Inter % 10; //calculation System.out.print("Digits in Interger are " + Dig1); System.out.print(" " + Dig2); System.out.print(" " + Dig3); System.out.print(" " + Dig4); System.out.print(" " + Dig5); } }
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.