[ ASSIGNMENT: ] Is 'n' Divisible by x AND y? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 27

[ ASSIGNMENT: ] Is 'n' Divisible by x AND y?

TASK : Create a methodย  isDivisible(n, x, y)ย  that checks if a number n is divisible by two numbers x AND y. NOTE : All inputs are positive, non-zero digits! ย ย  For Example : ย  isDivisible(3, 1, 3)ย  -->ย  true ย  because 3 is divisible by 1 and 3 ย  isDivisible(12, 2, 6)ย  -->ย  true ย ย because 12 is divisible by 2 and 6 ย  ย  isDivisible(100, 5, 3)ย  -->ย  false ย ย because 100 is not divisible by 3 ย ย isDivisible(12, 7, 5)ย  -->ย  false ย  because 12 is neither divisible by 7 nor 5 HappyCodings!:-)

14th Apr 2018, 9:29 AM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
35 Answers
14th Apr 2018, 3:37 PM
LukArToDo
LukArToDo - avatar
+ 21
https://code.sololearn.com/cf2n3WmP7i59/?ref=app
14th Apr 2018, 3:53 PM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 20
D_Stark LukArToDo Indeed, ๐Ÿ˜„๐Ÿ‘๐Ÿ‘ all the codes are great, ๐Ÿ˜†๐Ÿ‘ŒI have to say, ๐Ÿ‘and I'm really glad about it! ๐Ÿ˜Ž๐Ÿ‘ D_Stark, yours is in the choice ๐Ÿ˜„๐Ÿค˜ and I have another one where I can not choose !! ๐Ÿ˜๐Ÿ‘๐Ÿ‘๐ŸŒž
16th Apr 2018, 10:45 AM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
15th Apr 2018, 6:44 PM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 18
nati ๐Ÿ‘‰ Language!! ๐Ÿ‘ˆ ๐Ÿ˜‹๐Ÿ‘
16th Apr 2018, 10:48 AM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 17
I will give you one more easy task!! ๐Ÿ˜€๐Ÿ˜„๐Ÿ‘๐Ÿ˜‰๐Ÿค˜ Thanks a lot everyone for excellent support and participating!! ๐Ÿค— /* * Here I am doubting between the two * answers, ๐Ÿค”๐Ÿ˜…๐Ÿ˜Ž๐Ÿ‘Œ * which one to choose for the best โ˜กโ“ * ๐Ÿ˜„๐Ÿค—๐Ÿ‘๐Ÿ‘๐Ÿ‘ */
16th Apr 2018, 9:00 AM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 16
VcC ๐Ÿ˜ƒ๐Ÿ˜„๐Ÿ‘๐Ÿ˜Ž๐Ÿค˜
14th Apr 2018, 1:18 PM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 16
nati TASK : Create a methodย  isDivisible(n, x, y)ย  that checks if a number n is divisible by two numbers x AND y ? && Make a Code!!
16th Apr 2018, 8:43 AM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 15
nati We All have solutions like this !! ๐Ÿ˜Š boolean isDivisible(int n,int x,int y) { return n%x == 0 && n%y == 0 ? true : false; } but we need creativity in our codes!! ๐Ÿ˜†๐Ÿ‘
16th Apr 2018, 8:52 AM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 15
nati Okay, just slowly, we all struggle with something โ˜ก That's why we are here, SL allows us to progress, learn and find first-class people and excellent developers! ๐Ÿ˜Š๐Ÿ˜†๐Ÿ‘ I wish you luck and just go forward, we need time for everything! โ˜บ๐Ÿ‘Œ GoodLuck!! ๐Ÿ˜‰ && HappyCodings!! ๐Ÿ˜„๐Ÿค˜
16th Apr 2018, 9:57 AM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 15
D_Stark I agree with you ๐Ÿ‘
16th Apr 2018, 10:13 AM
LukArToDo
LukArToDo - avatar
+ 14
Xan You did a great job!! ๐Ÿ˜„๐Ÿ‘Œ๐Ÿ‘๐Ÿ‘๐Ÿ˜€ Thank you so much for listening my suggestion and do a job. ๐Ÿ˜‰๐Ÿ‘ I'm really grateful to you! ๐Ÿ˜†
14th Apr 2018, 11:00 AM
Danijel Ivanoviฤ‡
Danijel Ivanoviฤ‡ - avatar
+ 10
14th Apr 2018, 7:53 PM
ฦ’red
ฦ’red - avatar
+ 9
๐Ÿ™‹Hey! Here's mine... ๐Ÿ˜€๐Ÿ˜Š Zero is divisible by any number different than zero. https://code.sololearn.com/cIprMzfx96bK/?ref=app
14th Apr 2018, 3:51 PM
Fabio
+ 8
https://code.sololearn.com/cvJWHt9SI3EN/?ref=app
14th Apr 2018, 10:13 AM
Emma
14th Apr 2018, 12:06 PM
LunarCoffee
LunarCoffee - avatar
+ 8
https://code.sololearn.com/cB5J8lE2zk1s/?ref=app
14th Apr 2018, 1:42 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 8
Danijel Ivanoviฤ‡ i would do most readable ๐Ÿ˜‰ i think Manish Mahla or Xan made a good one ๐Ÿ˜‰๐Ÿ‘
16th Apr 2018, 10:08 AM
D_Stark
D_Stark - avatar
+ 7
even better: isdiv=lambda n,*p:not any(n%a for a in p) print(isdiv(24,2,3,4),isdiv(6,3,4))
14th Apr 2018, 1:16 PM
VcC
VcC - avatar
15th Apr 2018, 3:17 PM
D_Stark
D_Stark - avatar