0

Java program

Write a program that prompts the user to input a four-digit positive integer. The program then outputs the digits of the number, one digit per line. For example, if the input is 3245, the output is: 3 2 4 5

28th Dec 2019, 1:49 PM
sameer
sameer - avatar
2 Answers
+ 1
Take the input as a string and use the charAt() to print it.
28th Dec 2019, 1:57 PM
Avinesh
Avinesh - avatar
+ 1
Oh thanks bro.. I was thinking that how an integer can be accessed individually
28th Dec 2019, 1:59 PM
sameer
sameer - avatar