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

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*((sd[1])*(sd[2])*(sd[3]))); {compute area}
writeln ('Area = ', A);
end
end.
gabisa gila
ReplyDelete