Codechef•May 14, 2025
Decrement OR Increment
Hazrat Ali
Codechef
Write a program to obtain a number NN and increment its value by 1 if the number is divisible by 4 otherwiseotherwise decrement its value by 1.
Input Format
First line will contain a number NN.
Output Format
Output a single line, the new value of the number.
Constraints
- 0≤N≤1000
Sample 1:
Input
5
Output
4
Solution
m = int(input())
if m%4 == 0:
print(m+1)
else:
print(m-1)