Question: Write a program called hw2_1.cpp (or hw2_1.java) that reads a positive integer number from a user and displays the reverse of the number. For the

Write a program called hw2_1.cpp (or hw2_1.java) that reads a positive integer number from a user and displays the reverse of the number. For the program, you can assume that the input number is in the range of the typical int data type.

Sample Run 0: Assume that the user typed the following number.

1234321

This is the correct output.

1234321

Sample Run 1: Assume that the user typed the following number.

425

This is the correct output.

524

Sample Run 2: Assume that the user typed the following number.

1200

This is the correct output. Note that the reverse of 1200 is not 0021. It should be 21 because we should remove the leading zeros.

21

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!