Wanna compare challenge? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 16

Wanna compare challenge?

How about writing some codes without compare expressions? Bring a code with method which returns maximum from two inputed decimal numbers whithout using else-if statesments or <,>,== compare operators. Here my solution on c++ for (double) inputed numbers which >=0. https://code.sololearn.com/csUAy46hfPVi/#cpp Later I will improved for any numbers. Use any language.

5th Apr 2018, 2:06 PM
Dmytro Kovryzhenko
Dmytro  Kovryzhenko - avatar
7 Answers
13th Apr 2018, 10:02 PM
LukArToDo
LukArToDo - avatar
5th Apr 2018, 3:20 PM
John Wells
John Wells - avatar
+ 5
One-line✓ No expressions✓ No max() method✓ Negative numbers✓ 104 bytes✓ Enter two numbers separated by comma :) https://code.sololearn.com/c5CWbTly3RIO/?ref=app
14th Apr 2018, 1:41 AM
ƒred
ƒred - avatar
14th Apr 2018, 8:35 AM
Uni
Uni - avatar
+ 3
https://code.sololearn.com/cPA4s586WFBu/?ref=app Another one: (abusing list sort) https://code.sololearn.com/cm1dbDpHxEXT/?ref=app
5th Apr 2018, 2:31 PM
Alex
Alex - avatar
+ 2
Here is my own approach, it only works for positive numbers though, I will try to improve it later. https://code.sololearn.com/cgD9esVIkOkR/?ref=app
5th Apr 2018, 10:52 PM
Lucas Pardo
Lucas Pardo - avatar
+ 2
https://code.sololearn.com/c0foyi4mw6Tr/?ref=app
14th Apr 2018, 3:47 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar