109k views
4 votes
Pascal system . write the program that will calculate the perimeter of a rectangle if its area is A (m²) and one of its sides has a length of B (m). A and B are entered from the keyboard.​

User Wyu
by
5.4k points

1 Answer

4 votes

Answer:

The program in Pascal is as follows:

Program Perimeter;

Uses Crt;

Var

Length : Real;

Width : Real;

Area : Real;

Perim : Real;

Begin

Clrscr;

Write('Area: ');

Readln(Area);

Write('Length : ');

Readln(Length);

Width := Area/Length;

Perim := 2 * (Length + Width);

Write('Perimeter: ' ,Perim:5:2,'.');

End.

Step-by-step explanation:

This declares all variables as real

Var

Length : Real;

Width : Real;

Area : Real;

Perim : Real;

The program execution begins here

Begin

This clears the screen

Clrscr;

This prompts the user for Area

Write('Area: ');

This gets input for Area

Readln(Area);

This prompts the user for Length

Write('Length : ');

This gets input for Length

Readln(Length);

This calculates the width

Width := Area/Length;

This calculates the perimeter

Perim := 2 * (Length + Width);

This prints the calculated perimeter

Write('Perimeter: ' ,Perim:5:2,'.');

This ends the program

End.

User Clarisa
by
4.9k points