+ 9
[challenge] check if 11 is a Divisor of an input number without modulo
For this dont use modulo operator but use following rule: +first digit - second digit + third digit... result should be 0 or devisible by 11 Eg 187 : 7-8+1 = 0 use your preferred weapon and have fun
15 Réponses
+ 21
here is mine ☺
https://code.sololearn.com/crTPF7H2KkEl/?ref=app
+ 14
https://code.sololearn.com/c8yJskT1Y3jC/?ref=app
+ 10
#python is cool.
#another method..
#without using %
print('False' if int(str(int(input())/11).split('.')[-1])>0 else 'True')
+ 7
@younes, I've edited my code to cater for this condition.
+ 6
@Louis yep!
+ 6
@younes ok... repeat the procedure
+ 3
print(sum((-1)**k)*(n//10**k)%10 for k in range(99) if n<10**k))
+ 2
I checked a few random multiples of 11 just to see, and in the case of 11*46=506, the result is interestingly 11 :D
it would've been a 4 - 10 + 6 if it weren't for the decimal base ^^
+ 1
I hope I created the Simplest Version of all,
Created Using Python !
https://code.sololearn.com/cC0I1p8kYD7V/?ref=app