473,288 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

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);

}
}
Apr 6 '21 #1
1 4211
dev7060
626 Expert 512MB
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.
Apr 7 '21 #2

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

Similar topics

14
by: Erik Andersson | last post by:
Hi! I need to read a file (line-by-line) in reverse order, without reading the whole file into memory first. Is there an easy way of doing this? As in, is there a PHP function I could use? ...
3
by: James Lee | last post by:
I am doing a simple query like col1, col2, date, col4 from table1. All four colums are of type blob. For date column, I store a string like this: Fri Feb 13 11:01:24 2004 I store records as...
5
by: Artemis Fowl | last post by:
when i used bitset<> to accept data from the user, much to my surprise, i got the wrong answer. After a bit of fiddling, figured out that the data being entered was being consumed in reverse. I...
11
by: Boni | last post by:
Dear all, following code iterates thru the hash table. Dim _Enumerator As IDictionaryEnumerator = _myhashtable.GetEnumerator While _Enumerator.MoveNext() ....
10
by: aatish19 | last post by:
1: Write a program that asks the user to input an integer value and print it in a reverse order Sample Output Enter any number 65564 Reverse of 65564 is 46556 2: Write a program that takes a...
3
by: thrill5 | last post by:
I have an xml document such as: <device> <element>first</element> <element>second</element> </device> I am using this as the source for an xslt transform that goes like <xsl:for-each...
6
by: raghuveer | last post by:
i want to print my linked list in the reverse order ie..last item first and first item last..this is what i have so far struct linked_list { int number; struct linked_list *next; }; typedef...
5
by: dav3 | last post by:
I have almost completed a monster assignment on sorting algorithms (quick, insertion and selection) using c++ but I am lost on one part of the assignment. I have to generate a random list of numbers...
1
by: Mai Phuong | last post by:
Hi all, I have a datagriview and a data table. The order of rows in my datatable is r1,r2,r3,r4,r5, but now when displaying in datgridview I need to show them in the order of r5, r4, r3, r2, r1...
1
by: npm | last post by:
Hi, This javascript will display my xml node list: x=xmlDoc.getElementsByTagName('title'); for (i=0;i<x.length;i++) { document.write(x.childNodes.nodeValue); document.write("<br />"); } ...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.