Anyone explain else Loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Anyone explain else Loop

I don't know about excution of else Loop https://code.sololearn.com/cUu2pV5EsVC9/?ref=app

10th Mar 2018, 3:29 PM
arunkumar M (arun)
arunkumar M (arun) - avatar
7 Answers
+ 11
example ::: input is 9 , then output will be 1001 If u know how to convert decimal to binary then there must be no problem in understanding this , 👉U need to think from the opposite side ... not from front side (think backwards 👍) 👉(in java it return integer for integer/integer) ... greatest integer fraction for +ve integers 9%2=1 4%2=0 //4 is 9/2 2%2=0 //2 is 4/2 1%2=1 //1 is 2/2 //9 in binary will be 1001
10th Mar 2018, 4:19 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 8
else is not a loop //it can execute either 1 time ... if condition is true , and if condition is false then statements inside it will not execute it executes when condition in if() becomes false //question is unclear , U mean U want to know how to convert decimal to binary or what ?
10th Mar 2018, 3:49 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 4
That code is not quite right, try to enter dtob(1024) and see the output. I think you better follow @Gaurav's method.
10th Mar 2018, 4:25 PM
Ipang
+ 1
lol. I know I want to know it's excution
10th Mar 2018, 4:04 PM
arunkumar M (arun)
arunkumar M (arun) - avatar
0
that's decimal to binary conversion code
10th Mar 2018, 3:37 PM
arunkumar M (arun)
arunkumar M (arun) - avatar
0
how's it converting . just explain that program
10th Mar 2018, 4:08 PM
arunkumar M (arun)
arunkumar M (arun) - avatar
10th Mar 2018, 4:30 PM
arunkumar M (arun)
arunkumar M (arun) - avatar