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. 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
Get step-by-step solutions from verified subject matter experts
