Increment/Decrement Digits Programming Challenge, Lecture notes of C programming

the file contains a question for the daily challenge which was asked as a part of skillrack daily challenge

Typology: Lecture notes

2018/2019

Uploaded on 06/23/2019

tabraze-ali-meyan-m-a
tabraze-ali-meyan-m-a 🇮🇳

4.3

(6)

2 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
23/06/2019 skillrack.com/faces/candidate/dailychallenge.xhtml?k=DC
skillrack.com/faces/candidate/dailychallenge.xhtml?k=DC 1/1
LeaderBoard & Yesterday's Solution(/faces/candidate/leaderboarddailychallenge.xhtml?RT=DAILYCHALLENGE)
ProgramID- 8844 Solved By 631 Users
Increment/Decrement Digits
The program must accept an integer N as the input. The program must increment all the even digits of N by
1 and decrement all the odd digits of N by 1. Then the program must print the modied N as the output.
Boundary Condition(s):
1 <= N <= 10^8
Input Format:
The rst line contains N.
Output Format:
The rst line contains modied N.
Example Input/Output 1:
Input:
12389
Output:
3298
Exaplanation:
1 is odd so it is decremented as 0 the number becomes 02389. The leading zero for integer is removed as
2389.
2 is even so it is incremented by 1 the number becomes 3389.
3 is odd so it is decremented by 1 the number becomes 3289.
8 is even so it is incremented by 1 the number becomes 3299.
9 is odd so it is decremented by 1 the number becomes 3298.
Example Input/Output 2:
Input:
41571
Output:
50460
Daily Challenge SkillRack
Proceed to Solve the Program

Partial preview of the text

Download Increment/Decrement Digits Programming Challenge and more Lecture notes C programming in PDF only on Docsity!

23/06/2019 skillrack.com/faces/candidate/dailychallenge.xhtml?k=DC

skillrack.com/faces/candidate/dailychallenge.xhtml?k=DC 1/

LeaderBoard & Yesterday's Solution(/faces/candidate/leaderboarddailychallenge.xhtml?RT=DAILYCHALLENGE)

ProgramID- 8844 Solved By 631 Users

Increment/Decrement Digits

The program must accept an integer N as the input. The program must increment all the even digits of N by 1 and decrement all the odd digits of N by 1. Then the program must print the modied N as the output. Boundary Condition(s): 1 <= N <= 10^ Input Format: The rst line contains N. Output Format: The rst line contains modied N. Example Input/Output 1: Input: 12389 Output: 3298 Exaplanation: 1 is odd so it is decremented as 0 the number becomes 02389. The leading zero for integer is removed as

2 is even so it is incremented by 1 the number becomes 3389. 3 is odd so it is decremented by 1 the number becomes 3289. 8 is even so it is incremented by 1 the number becomes 3299. 9 is odd so it is decremented by 1 the number becomes 3298. Example Input/Output 2: Input: 41571 Output: 50460

Daily Challenge SkillRack

Proceed to Solve the Program