Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started