**Formula of Area of Triangle:**

**Area**=**(**s (s-a) (s-b) (s-c)**)**^**(**1/2**)**- where
**s**= (a+b+c)**/**2 **a**,**b**and**c**are the Sides of Triangle.

**Statement of C Program: Write a Program to Find the Area of a Triange , given the Three Sides of Triangle:**

#include<stdio.h>

#include<conio.h>

void main()

**int**a, b, c, s, Area;

clrscr();

printf(" Enter the values of a,b and c\n ");

printf(" Enter the values of a,b and c\n ");

scanf(" %d %d %d " , &a, &b, &c);

**S**=(a+b+c)/2;

**Area**= sqrt

**(**s (s-a) (s-b) (s-c)

**)**; //

**sqrt**used for Square Root

printf(" Area of Triangle = %d\n " , Area);

}

Output:

Enter the values of a, b and c

3

4

5

Area of Triangle = 6

I made the same program but when i run it..it give the output NAN.

ReplyDeleteCan u explain why's that?

we should also inluce a headerfile #include

DeleteNt only a # include bt u sd write #include"math.h" before,dn run

DeleteThis comment has been removed by the author.

ReplyDeletewe should also include

ReplyDeletea headerfile #include

There is used #include

ReplyDeleteThere is used #include

ReplyDeleteit shows me function sqrt should written a prototype whats the solution

ReplyDeleteHow to write program in float?

ReplyDelete%f

Deleteplz use #include

ReplyDeleteVery informative article.Thank you author for posting this kind of article .

ReplyDeletehttp://www.wikitechy.com/view-article/write-a-c-program-to-find-area-of-triangle-with-example-and-explanation

Both are really good,

Cheers,

Venkat