From 0b6a3952acf8d69d813e68165e5e9313b075a145 Mon Sep 17 00:00:00 2001 From: 101zh <67253838+101zh@users.noreply.github.com> Date: Wed, 25 Oct 2023 23:31:45 +0000 Subject: [PATCH] feat(4.2.2): Finish U4_L2_Activity_Two --- src/main/java/Unit4/U4_L2_Activity_Two.java | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/main/java/Unit4/U4_L2_Activity_Two.java diff --git a/src/main/java/Unit4/U4_L2_Activity_Two.java b/src/main/java/Unit4/U4_L2_Activity_Two.java new file mode 100644 index 0000000..729a0b3 --- /dev/null +++ b/src/main/java/Unit4/U4_L2_Activity_Two.java @@ -0,0 +1,23 @@ +package Unit4; + +import java.util.Scanner; + +public class U4_L2_Activity_Two { + public static void main(String[] args){ + Scanner scanner = new Scanner(System.in); + + System.out.println("Enter a positive integer:"); + System.out.print("> "); + int num = scanner.nextInt(); + + int index=0; + while(num>0){ + System.out.println((num%10)* (int) Math.pow(10, index)); + index++; + num/=10; + } + + scanner.close(); + + } +}