Q: Write a C++ Program to input three sides of a triangle. The

Where s = ( a+b+c ) / 2

**program then calculates the Area of triangle by the formula**Formula of area of triangle when 3 sides given |

## Write Down Algorithm of C++ Program Area of Triangle

1. Start

2. Input a,b,c

3. Calculate s = (a + b + c ) / 2

4. Calculate area = sqrt( s*(s-a)*(s-b)*(s-c))

5. print "Area of Triangle=", area

6. End

### Develop Flowchart of C++ Program Area of Triangle

develop flowchart c plus plus program area of triangle |

Generally we prepare a flowchart and algorithm which is independent of any programming language so here is a better flowchart version for

**with mathematical formula instead of C++ arithmetic expressions.**__C++ Program Area of Triangle__#### Flowchart for C++ Program How To Calculate Area of triangle when 3 side are input

develop flowchart c plus plus program area of triangle programming language independent |

### Write Down Source Code of C++ Program Area of Triangle

**#include<iostream.h>**

**#include<conio.h>**

**#include<math.h>**

**void main( )**

**{**

**float a,b,c,s,area;**

**clrscr();**

**cout<<"Enter side A of triangle = ";**

**cin>>a;**

**cout<<"Enter side B of triangle = ";**

**cin>>b;**

**cout<<"Enter side C of triangle = ";**

**cin>>c;**

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

**area = sqrt ( s * (s - a ) * (s - b ) * (s - c ) ) ;**

**cout<< "Area of Triangle = "<<area;**

**getch();**

**}**

## 0 comments:

## Post a Comment

We Love To Hear From You!