% Triangle:  Draw a triangle and show its area
% Points (px,py), (qx,qy), (rx,ry) are the vertices of a triangle.
% All coordinates are in the range of 1 to 10.

close all  % Close all previous figure windows

%---------------------------------------------------------------
% Make your modifications below

px= 2.5;
py= 2;
qx= 8.5;
qy= 2;
rx= 3;
ry= 9;

area= 21;  % Area of the triangle

% Make your modifications above
%---------------------------------------------------------------

% Draw the triangle
hold on
plot([px,qx], [py,qy])
plot([qx,rx], [qy,ry])
plot([rx,px], [ry,py])
message= sprintf('Random triangle has area %.1f', area);
title(message)  % Show message as the title of the plot
axis('equal')
axis([1 10 1 10])

