+ 1

write a programe to check given number is divisible by 3,5,and7.(python)

only python

22nd Sep 2017, 3:43 AM
Manikanta Dangeti
Manikanta Dangeti - avatar
8 Réponses
22nd Sep 2017, 6:32 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 4
Hello World better in this way #making a function (this is the main code) def tfs(n): if n%3==0 and n%5==0 and n%7==0: return True; else: return False #testing it out print(tfs(105)) print(tfs(67))
22nd Sep 2017, 5:02 AM
Daniel
Daniel - avatar
+ 2
Daniel Fernández Hidalgo, how about this? :^) #making a function (this is the main code) def tfs(n): return n%3 == n%5 == n%7 == 0 #testing it out print(tfs(105)) print(tfs(67))
22nd Sep 2017, 7:35 AM
Edgar Garrido
Edgar Garrido - avatar
+ 2
n = int(input()) nd = any(n % i for i in (3, 5, 7)) print("{}divisible".format("not " if nd else "")) https://code.sololearn.com/csC6ZNuwnpBq/?ref=app
22nd Sep 2017, 8:41 AM
David Ashton
David Ashton - avatar
+ 1
The best Edgar ;-)
22nd Sep 2017, 7:39 AM
Daniel
Daniel - avatar
22nd Sep 2017, 4:11 AM
Hello World!!!!
Hello World!!!! - avatar
0
if int(input(" ")) % 105 == 0 : print("divisible")
22nd Sep 2017, 4:47 AM
sayan chandra
sayan chandra - avatar
0
num=int(input("enter a number")) if num%3==0 and num%7==0 and num%5==0: print("divisible by 3 5 and 7")
11th Feb 2019, 2:28 AM
Madhvi asthana
Madhvi asthana - avatar