468,113 Members | 2,124 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,113 developers. It's quick & easy.

Print 2021 one digit per line in reverse order and in vertically order?

import java.util.Scanner;
public class STressed
{
public static void main(String[] args)
{
int number = 2021 , Reverse = 0;

while(number !=0)
{
int digit =number%10;

Reverse = Reverse * 10+digit;

}

System.out.println(" Reversed number: " + Reverse);

}
}
1 Week Ago #1
1 1121
dev7060
413 Expert 256MB
Expand|Select|Wrap|Line Numbers
  1. import java.util.Scanner;
  2. public class STressed
  3. {
  4. public static void main(String[] args)
  5. {
  6. int number = 2021 , Reverse = 0;
  7.  
  8. while(number !=0)
  9. {
  10. int digit =number%10;
  11.  
  12. Reverse = Reverse * 10+digit;
  13.  
  14. }
  15.  
  16. System.out.println(" Reversed number: " + Reverse);
  17.  
  18. }
  19. }
What's the question? 'number' may need updation.
5 Days Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

14 posts views Thread by Erik Andersson | last post: by
3 posts views Thread by James Lee | last post: by
5 posts views Thread by Artemis Fowl | last post: by
10 posts views Thread by aatish19 | last post: by
3 posts views Thread by thrill5 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.