Computer Science, asked by patelarchee2006, 5 months ago

Write a program to input any number and print the odd digits are decreased by 1 and the
even digits are increased by 1.
Eg. Input : N= 2796041
Output: 3687150​

Answers

Answered by debroytanusree
1

Answer:

First, calculate the reverse of the given number.

To the reverse number we apply modulus operator and extract its last digit which is actually the first digit of a number so it is odd positioned digit.

The next digit will be even positioned digit, and we can take the sum in alternating turns.

Below is the implementation of the above approach:

Explanation:

PLEASE THANKS TO ME

Answered by masoommishra
2

Answer:

Input : 22233

Output : NO

count_even_digits = 3

count_odd_digits = 2

In this number even digits occur odd number of times and odd

digits occur even number of times so its print NO.

Input : 44555

Output : YES

count_even_digits = 2

count_odd_digits = 3

In this number even digits occur even number of times and odd

digits occur odd number of times so its p .

My answer is not exact but you can take the idea from it

Similar questions