Decrement OR Increment Problem Code: DECINC (CodeChef)
Write a program to obtain a number and increment its value by 1 if the number is divisible by 4 decrement its value by 1.
Input:
- First line will contain a number .
Output:
Output a single line, the new value of the number.
Constraints
Sample Input:
5
Sample Output:
4
EXPLANATION:
Since 5 is not divisible by 4 hence, its value is decreased by 1.
Solution:
N=int(input())
if(N%4==0):
print(N+1)
else:
print(N-1)
Comments
Post a Comment