[ ASSIGNMENT: ] Binary Numbers | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 40

[ ASSIGNMENT: ] Binary Numbers

Given a base-10 integer, n, convert it to binary (base-2). Print a single base-10 integer denoting the maximum number of consecutive 1's in the binary representation of n. Sample Input : 5 Sample Output : 1 The binary representation of 5 is 101, so the maximum number of consecutive 1's is 1. Sample Input : 13 Sample Output : 2 The binary representation of 13 is 1101, so the maximum number of consecutive 1's is 2. HappyCodings!:-)

24th Jan 2018, 2:53 PM
Danijel Ivanović
Danijel Ivanović - avatar
32 Answers
24th Jan 2018, 5:37 PM
LukArToDo
LukArToDo - avatar
25th Jan 2018, 2:13 AM
Swapnil Srivastava
Swapnil Srivastava - avatar
+ 23
24th Jan 2018, 7:03 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 23
https://code.sololearn.com/cfTqfPs5WU9H/?ref=app
24th Jan 2018, 10:41 PM
Danijel Ivanović
Danijel Ivanović - avatar
25th Jan 2018, 12:54 PM
Justine Ogaraku
Justine Ogaraku - avatar
+ 16
We finally started !! 👏😆👍 Thank you guys 👏😊😉 all of you !! 👍😆😎
24th Jan 2018, 5:31 PM
Danijel Ivanović
Danijel Ivanović - avatar
25th Jan 2018, 7:29 AM
Ipang
+ 15
@Pyctam and ?!!! I'm Bosnian 😆
24th Jan 2018, 3:02 PM
Danijel Ivanović
Danijel Ivanović - avatar
25th Jan 2018, 6:56 AM
Mahdi Cheikhrouhou
Mahdi Cheikhrouhou - avatar
+ 15
@Russ Make your code Public !! 😉
28th Jan 2018, 8:51 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 14
Man... A little bit complicated, but here is my try. Good challenge! ✌👍👌 https://code.sololearn.com/c31eOUW1noxR/?ref=app
24th Jan 2018, 5:16 PM
Fabio
24th Jan 2018, 6:17 PM
Luc Hariman Randrianomenjanahary
Luc Hariman Randrianomenjanahary - avatar
25th Jan 2018, 11:02 AM
Anurag Gulati
+ 11
https://code.sololearn.com/cEA9Z0ev7oqU/?ref=app
29th Jan 2018, 5:15 AM
Sachin
Sachin - avatar
27th Jan 2018, 10:35 PM
Saurabh Tiwari
Saurabh Tiwari - avatar
25th Jan 2018, 2:51 AM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar
25th Jan 2018, 10:39 AM
Dominik Dudek
Dominik Dudek - avatar
25th Jan 2018, 1:04 PM
Freddy
25th Jan 2018, 8:28 PM
Luc Hariman Randrianomenjanahary
Luc Hariman Randrianomenjanahary - avatar
+ 7
I usually make one-liners but this time I was too lazy... https://code.sololearn.com/c9eFNghiu4fz/?ref=app
25th Jan 2018, 8:41 PM
🐙evil octopus
🐙evil octopus - avatar