Thursday, November 10, 2016

// // Leave a Comment

Pascal Program Using Hero’s Formular To Calculate Area Of A Triangle

Just came across a program I wrote then in school to calculate area of triangle using Hero's formula.
calculate area of triangle using Hero's formula

Area of triangle flowchart
Program flowchart


/**
 *
 * @Author: Aghatise Osazuwa
 * Website: www.cscprogrammingtutorials.com
 *
 */ 

Program AreaOfTriangle;
const
PI = 3.142;
type
r=array [1..3] of real; {hold the values of sides of triangle}
var
d:r;
A:real;
K:integer;
s:real;
begin
   For k:= 1 to 10 Do  {loop for the 10 sets of values}
     begin
        writeln ('Enter Values of first side');
        read (d[1]);
        writeln ('Enter Values of second side');
        read (d[2]);
        writeln ('Enter Values of third side');
        read (d[3]);
        s:= (d[1]+d[2]+d[3])/2;  {compute s}
           A:= Sqrt(s*((s-d[1])*(s-d[2])*(s-d[3]))); {compute area}
        writeln ('Area = ', A);
     end
end.       

0 comments:

Post a Comment


DISCLAIMER: Opinions expressed in comments are those of the comment writers alone and does not reflect or represent the views of the post author. We reserve the right to delete any post deemed inappropriate or offensive and/or spammy. Please do not use abusive words/hate speech.

I Appreciate your valuable Feedback. So, Please DO NOT SPAM - Spam comments will be deleted immediately.

Don't use brand name in name field and you're not allowed to use links in comments unless it's necessary. Such comments will be removed immediately.

Thanks.