+ 1

Scanf issue maybe

Distance between two points...idk why i am getting wrong outputs.i suspect simultaneously using scanf is the issue....anyone help...Beecrwod problem https://code.sololearn.com/chM5pHPEdxms/#c

15th Jul 2022, 1:54 PM
ANIK
ANIK - avatar
4 Réponses
+ 2
You are taking inputs as x1, x2 then y1, y2. Your expected output works fine if you take input as x1, y1, then x2, y2 if you input like : 1.0 5.0 7.0 9.0 (5.0-1.0) * (5-1) + (9-7) *(9-7) = 16.0+4.0 = 20.0 sqrt(20.0) = 4.4721 if you input as : 1.0 7.0 5.0 9.0 (7.0-1.0) *(7.0-1.0) + ( 9-5 * 9-5) = 36.0+16 = 52.0 sqrt( 52.0) = 7.2111
15th Jul 2022, 2:06 PM
Jayakrishna 🇮🇳
+ 2
What is your sample input and expected output...?
15th Jul 2022, 1:56 PM
Jayakrishna 🇮🇳
+ 1
1.0 7.0 5.0 9.0 out:4.4721
15th Jul 2022, 1:57 PM
ANIK
ANIK - avatar
+ 1
Wow, this was the problem..this was so subtle I just ignored it.
15th Jul 2022, 2:15 PM
ANIK
ANIK - avatar