Write a python program that inputs a number and checks whether the number is divisible by 4. in Python
Answers
Answered by
0
Answer:
Note than 100, 1000, ... etc lead to remainder 0 when divided by 4. So remainder of "7*10000 + 6*1000 + 9*100 + 5*10 + 2" divided by 4 is equivalent to remainder of following : 0 + 0 + 0 + 5*10 + 2 = 52 Therefore we can say that the whole number is divisible by 4 if 52 is divisible by 4
Answered by
3
usin = int(input())
if usin % 4 == 0:
print("The given number is divisible by 4")
else:
print("The given number is not divisible by 4")
- We took input in a variable named "usin".
- We designed a if..else... framework and gave the required conditions.
- Note that '%' sign is used to obtain remainder.
Hope it helps...
Similar questions