Back to General discussions forum
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!
becuz 970+964>1098 triangle rule
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.
Hmm.. It seems like I was only thinking about right angled triangles.
But,
Thanks for your help guys.. I finally solved the problem :)