Write a program to input any number and print the odd digits are decreased by 1 and the
even digits are increased by 1.
Answers
Answered by
0
Hieee....
Alternative method: sum of the digits of the given number 54638 is 26. There are two odd numbers and three even numbers. Since an odd number is decreased by 1 and even number is increased by 1 so the net increase in the sum of the digits is 3 - 2 i.e. 1
Alternative method: sum of the digits of the given number 54638 is 26. There are two odd numbers and three even numbers. Since an odd number is decreased by 1 and even number is increased by 1 so the net increase in the sum of the digits is 3 - 2 i.e. 1Hence the new sum is 26 + 1 i.e. 27.
Answered by
5
Answer:
Input: N = 54873
Output:
Sum odd = 16
Sum even = 11
Input: N = 457892
Output:
Sum odd = 20
Sum even = 15
Similar questions