• Language

    Pascal

  • Description

    It calculates tha area and the perimeter of a rectangle getting the height and the width.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
program AreaAndThePerimeterOfARectangle;
uses crt;

var area, height, perimeter, width : real;
begin
    write ('Enter the value of height: ');
    readln (height);
    write ('Enter the value of width: ');
    readln (width);
    area := height*width;
    perimeter := height*2+width*2;
    writeln ('Value of area: ', area:0:6);
    writeln ('Value of perimeter: ', perimeter:0:6);
    writeln;
    write ('Press any key to finish . . . ');
    readkey;
end.