+ 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

8th Jan 2018, 6:57 PM
Oma Falk
Oma Falk - avatar
15 Respuestas
10th Jan 2018, 1:54 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 14
https://code.sololearn.com/c8yJskT1Y3jC/?ref=app
9th Jan 2018, 6:38 PM
LukArToDo
LukArToDo - avatar
10th Jan 2018, 5:30 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
8th Jan 2018, 7:16 PM
Louis
Louis - avatar
+ 10
#python is cool. #another method.. #without using % print('False' if int(str(int(input())/11).split('.')[-1])>0 else 'True')
10th Jan 2018, 6:58 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
9th Jan 2018, 4:48 PM
Louis
Louis - avatar
+ 7
@younes, I've edited my code to cater for this condition.
9th Jan 2018, 4:40 AM
Louis
Louis - avatar
+ 6
@Louis yep!
8th Jan 2018, 8:29 PM
Oma Falk
Oma Falk - avatar
+ 6
@younes ok... repeat the procedure
9th Jan 2018, 2:52 AM
Oma Falk
Oma Falk - avatar
9th Jan 2018, 9:40 PM
Saurabh Tiwari
Saurabh Tiwari - avatar
10th Jan 2018, 4:41 AM
Jonathan Pizarra (JS Challenger)
Jonathan Pizarra (JS Challenger) - avatar
+ 3
print(sum((-1)**k)*(n//10**k)%10 for k in range(99) if n<10**k))
8th Jan 2018, 9:01 PM
VcC
VcC - avatar
+ 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 ^^
8th Jan 2018, 9:55 PM
Younes L.
Younes L. - avatar
+ 1
I hope I created the Simplest Version of all, Created Using Python ! https://code.sololearn.com/cC0I1p8kYD7V/?ref=app
31st Jan 2018, 2:39 PM
Sai Eshwar
Sai Eshwar - avatar