107k views
0 votes
Write a python program to check whether the number is divisible by 7. If its divisible, print its divisible otherwise find previous number and the next number which is divisible by 7​

User Jbyen
by
4.4k points

1 Answer

5 votes

f = int(input("Enter a number: "))

if(f%7==0):

print("It's divisible by 7.")

else:

if(f<7):

print("7")

else:

print(str(f-(f%7))+", "+str(f+(7-(f%7))))

User Pyjong
by
5.2k points