Question: python Given a positive integer 'x' (with even number of digits in it), write an algorithm and the subsequent code to compute the difference between
Given a positive integer 'x' (with even number of digits in it), write an algorithm and the subsequent code to compute the difference between the sum of the digits occurring in the alternate positions (starting from the first position) and the sum of the digits occurring in the alternate positions, starting from the last rightmost position of 'x' For example, consider the number 8975. The sum of the digits that occur in the alternate positions from the first position is 8+7=15. The sum of the digits that occur in the alternate positions, starting from the rightmost position is 5+9 = 14. Difference between the two sums is 1 (= 15-14). Similarly, for the number 5798, the difference between two sums, is 1. Input format: Enter an integer number with even number of digits Output Format: Differece of Sum of alternate digits
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
