Task 9 - Triangles

Back to General discussions forum

Nazibul_Haider     2018-06-10 19:59:48

I wrote a program in c++ according to A^2 + B^2 = C^2. An example from the checker was ' 970 1098 964 '. The checker says that it's correct but my program says it isn't.

So can anyone please explain me that,

970^2 = 940900

964^2 = 929296

940900 + 929296 = 1870196

1098^2 = 1205604

Thus, A^2 + B^2 != C^2. Therefore, a Triangle shouldn't be made. Right? But, the checker says that a triangle could be made!

lil eddy son     2018-06-11 03:24:45

becuz 970+964>1098 triangle rule

Quandray     2018-06-11 06:09:57
User avatar

A^2+B^2=C^2 only works for right angled triangles. 970 1098 964 can make a triangle, but it's not right angled.

Nazibul_Haider     2018-06-11 09:13:54

Hmm.. It seems like I was only thinking about right angled triangles.

But,

Thanks for your help guys.. I finally solved the problem :)

Please login and solve 5 problems to be able to post at forum