Problem
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.
Program :
#include<stdio.h>
int main()
{
int a;
scanf("%d",&a);
if(a%4==0)
printf("%d",++a);
else
printf("%d",--a);
}
0 Comments