Question: Write a code to get an integer number as input, n. Then rearrange each digit of the given number such that the even digits comes

 Write a code to get an integer number as input, n.

Write a code to get an integer number as input, n. Then rearrange each digit of the given number such that the even digits comes first and then the odd digits of the number, say rearrange_n. Print the absolute difference of n and rearrange_n Input: A single line contains the value of n Output: A single line contains difference of numbers Sample test case: Input: 4326 Output: 63 Explanation: n=4326. After rearranging of digits, rearrange_n=4263. Here, the number is rearranged as even digits first, then odd digits. The order of even or odd digits is not changed. Now, absolute difference of n and rearrange_n is 63 For example: Test Input Result 1 4326 63

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!