Your task is to write a program that will take as input an integer, and swap its left half with itsright half.

Joined
Sep 24, 2022
Messages
1
Reaction score
0
Note that if the length of the integer is odd, then the left half will contain the digit in
the exact middle position (for example: the left half of 65237 is 652, and the right half is 37).

Sample Input: 984897 > Sample Output: 897984
Sample Input: 65237 > Sample Output: 37652
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,193
Members
46,760
Latest member
HermineT96

Latest Threads

Top