guys sorry for bothering you, but i am tired of submitting my jerky code again and again: i used area=height*base/2 approach, rather than what was taught on editorial. and i glanced some of AC codes even there i realized that i was the only one who actually could “poke the box”, almost all codes i saw looked similar to editorial approach. btw, can you pls, correct my code based on my approach(if you want to do so). thanks beforehand

404 file not found…:stuck_out_tongue:


the formula (height*base)/2 to calculate area can be used only when height is perpendicular to the base.

consider the triangle given by coordinates

8 -1 0 0 1 4

the area is 16.5 neglecting division by 2 the area calculated should be 33, but ur program outputs 40.

1 Like

imho, everyone used Herons formula:

but i used 1st method

tnx for the answer anyway

or am i wrong on my approach :expressionless:

u cannot use this method to calculate the area of triangles where the height is not perpendicular to the base… so the best way to olsve this is to use the method described in the editorial( ) :slight_smile:

ok, thanks