[email protected] wrote: > aot=1/2*b*h; > Equvilent to > aot = 1/(2*b*h); > > That why your ans is 0.00000 > > Your can try this > aot = b*h*1/2; >
This is bad advice. 1/2*b*h is NOT equivalent to 1/(2*b*h) Division and multiplication are of equal precedence. If you want to add parenthesis to make the order of operations clearer then: 1/2*b*h is equiv to ((1/2)*b)*h The answer is 0.0 because (1/2) is integer division whose result is 0. To correct your problem do one of the following: aot = 0.5*b*h; or aot = b*h/2;
