Write a program which accepts a sequence of comma separated 4 digit binary numbers as its input and then check whether they are divisible by 5 or not. the numbers that are divisible by 5 are to be printed in a comma separated sequence
Answers
Answered by
11
Hey
hERE'S Your answer
_____________________________
Your Question ,
write a program which accepts a sequence of comma separated
4 digit binary numbers as its input and then check whether they are divisible by 5 or not.
The numbers that are divisible by 5 are to be printed in a comma separated sequence
________________________________________
#Solution:
value = []
items=[x for x in raw_input().split(',')]
for p in items:
print p
intp = int(p, 2)
print intp
if not intp%5:
value.append(p)
print ','.join(val
Hope helped:)______________________________
hERE'S Your answer
_____________________________
Your Question ,
write a program which accepts a sequence of comma separated
4 digit binary numbers as its input and then check whether they are divisible by 5 or not.
The numbers that are divisible by 5 are to be printed in a comma separated sequence
________________________________________
#Solution:
value = []
items=[x for x in raw_input().split(',')]
for p in items:
print p
intp = int(p, 2)
print intp
if not intp%5:
value.append(p)
print ','.join(val
Hope helped:)______________________________
Similar questions