Home C Programs Area Of Triangle Program In C

Area Of Triangle Program In C

2 193
area of triangle

Area Of Triangle Description

Area is a measure of the space covered by a two dimensional region.
To find area of triangle: Tessa late a region with another fundamental region, then count the number of copies  of the fundamental region needed to cover the original region. That count is the area.
Note: When only part of a square is included in a triangle, we may be able to put it together with another part square in the triangle to form a whole square.

Area Of Triangle

Area Of Triangle

AIM: To evaluate area of triangle (sqrt(s(s-a)(s-b)(s-c)

2) ALGORITHM:

Step1:start
Step2:input a,r,t,s
Step3:s=a* pow(-r*t)
Step4:Result s
Step 5:stop*/

3) FLOWCHART

Area Of Triangle

Area Of Triangle

3) FLOWCHART:

4) PROGRAM: To evaluate area of triangle (sqrt(s(s-a)(s-b)(s-c)

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a,b,c;
float s,area;
clrscr();
printf(“enter the values of a,b,c”);
scanf(“%d%d%d”,&a,&b,&c);
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf(“the area of a trangle is =%f”,area);
getch();
}

5) Result:

enter the values of a,b,c
10
20
30
The area of a trangle is = 0.000000

6) Questions:

i) What is the use of sqrt( ) function?
ii) Explain data types.
iii) Explain I/O Statements.

7) Debugging:

1) Function ‘sqrt( )’ should have a prototype You should include ‘math.h’ first, then you can use ‘sqrt ( )’ and other mathematical functions.
2) Unterminated string or character constant You should end double quotation or single quotation properly
3) Function call missing ‘)’ in function main You might be missed any special characters in that line.

SIMILAR ARTICLES

2 COMMENTS

Leave a Reply