3 nos are input. Output will be 1 if 3 nos can form a triangle or else output 0. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

3 nos are input. Output will be 1 if 3 nos can form a triangle or else output 0.

https://code.sololearn.com/c5YvMYfbi0YU/?ref=app pls check my code. I am not able to run it properly.

9th Sep 2018, 10:35 AM
Nilutpol Kashyap
Nilutpol Kashyap - avatar
3 Answers
+ 4
If 3 numbers form a triangle, all three inequalities must hold => replace || with && in first condition. ^ is not exponentiation, but binary xor. To get second power use x*x.
9th Sep 2018, 10:48 AM
michal
+ 2
Nilutpol Kashyap you're welcome
9th Sep 2018, 10:53 AM
michal
+ 1
thanks a lot michal it did work
9th Sep 2018, 10:53 AM
Nilutpol Kashyap
Nilutpol Kashyap - avatar