Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class DigitBreaker {
- public static void main(String[] args) {
- Scanner x = new Scanner(System.in);
- System.out.print("input digits: ");
- int num = x.nextInt();
- int num2 = num;
- int i = 0;
- int j = 1;
- int k = 1;
- while(num2 !=0)
- {
- num2/=10;
- i++;
- }
- while(k < i)
- {
- j*=10;
- k++;
- }
- System.out.print(j + " value of j ");
- System.out.print("Expected Output: ");
- while(num != 0 && j !=0)
- {
- System.out.print(num/j + " ");
- num = num%10;
- j/=10;
- }
- x.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement