On Thu, Apr 3, 2008 at 10:12 AM, mdnizdil <[EMAIL PROTECTED]> wrote: > Please help me. In this question a,b,c are legs of the triangle. > And I want to find area of the triangle. > > s=(a+b+c)/2 > Area=s*((s-a)(s-b)(s-c)) ^ (1/2) > > I wrote the programme, could you please correct my programme. > [...] > area=sqrt(pow(s*(s-a)(s-b)(s-c)),1/2);
1) That closing parens is in the wrong place. 2) 1/2 in this expression resolves to 0 (since you're inplicitly using integer arithmetic instead of floating point.) Use either 1.0/2 or 0.5 instead to get '1/2' 3) You're using sqrt() to get a root and appear to be trying to use pow() to get another root, why not just get the 4th root by using pow(..., 1.0/4) and remove the sqrt() call? -- PJH A man in a shellsuit goes into a posh furriers. He says to the shop assistant "I want a coat". The shop assistant, barely concealing her disdain, asks "What fur?" The man replies "Fur ma girlfriend".
