Search C++ Programs and Tutorials

Thursday, March 22, 2018

Program Area of Triangle Algorithm Flowchart

Leave a Comment
Q: Write a C++ Program to input three sides of a triangle. The program then calculates the Area of triangle by the formula 
Formula of area of triangle when 3 sides given
Formula of area of triangle when 3 sides given
Where s = ( a+b+c ) / 2

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

C++ Program develop flowchart c plus plus 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 C++ Program Area of Triangle with mathematical formula instead of C++ arithmetic expressions.

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
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();
}
If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment

We Love To Hear From You!