Computer Science, asked by itzichchha, 1 day ago

WAP that ask length of a square and calculates it area and perimeter.

Answers

Answered by BrainIyKohinoor
0

Answer:

REM PROGRAM TO DISPLAY AREA OF RECTANGLE

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

A = L * B

PRINT “AREA OF RECTANGLE ”; A

END

USING SUB PROCEDURE

DECLARE SUB AREA (L, B)

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

CALL AREA(L, B)

END

SUB AREA (L, B)

A = L * B

PRINT “AREA OF RECTANGLE ”; A

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION AREA (L, B)

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

AR = AREA(L, B)

PRINT “AREA OF RECTANGLE ”; AR

END

FUNCTION AREA (L, B)

A = L * B

AREA = A

END FUNCTION

16. Display area of square.

REM PROGRAM TO DISPLAY AREA OF SQUARE

CLS

INPUT “ENTER LENGTH”; L

A = L ^ 2

PRINT “AREA OF SQUARE ”; A

END

USING SUB PROCEDURE

DECLARE SUB AREA (L)

CLS

INPUT “ENTER LENGTH”; L

CALL AREA(L)

END

SUB AREA (L)

A = L ^ 2

PRINT “AREA OF SQUARE”; A

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION AREA (L)

CLS

INPUT “ENTER LENGTH”; L

AR = AREA(L)

PRINT “AREA OF SQUARE ”; AR

END

FUNCTION AREA (L)

A = L ^ 2

AREA = A

END FUNCTION

17. Display area of circle.

REM PROGRAM TO DISPLAY AREA OF CIRCLE

CLS

INPUT “ENTER RADIUS”; R

A = 3.14 * R ^ 2

PRINT “AREA OF CIRCLE ”; A

END

USING SUB PROCEDURE

DECLARE SUB AREA (R)

CLS

INPUT “ENTER RADIUS”; R

CALL AREA(R)

END

SUB AREA (R)

A = 3.14 * R ^ 2

PRINT “AREA OF CIRCLE ”; A

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION AREA (R)

CLS

INPUT “ENTER RADIUS”; R

AR = AREA(R)

PRINT “AREA OF CIRCLE ”; AR

END

FUNCTION AREA (L, B)

A = 3.14 * R ^ 2

AREA = A

END FUNCTION

18. Display perimeter of rectangle.

REM PROGRAM TO DISPLAY PERIMETER OF RECTANGLE

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

P = 2 * (L + B)

PRINT “PERIMETER OF RECTANGLE ”; P

END

USING SUB PROCEDURE

DECLARE SUB PERIMETER (L, B)

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

CALL PERIMETER(L, B)

END

SUB PERIMETER (L, B)

P = 2 * (L + B)

PRINT “PERIMETER OF RECTANGLE ”; P

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION PERIMETER (L, B)

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

PR = PERIMETER(L, B)

PRINT “PERIMETER OF RECTANGLE ”; PR

END

FUNCTION PERIMETER (L, B)

P = 2 * (L + B)

PERIMETER = P

END FUNCTION

19. Display perimeter of square.

REM PROGRAM TO DISPLAY PERIMETER OF SQUARE

CLS

INPUT “ENTER LENGTH”; L

P = 4 * L

PRINT “PERIMETER OF SQUARE ”; P

END

USING SUB PROCEDURE

DECLARE SUB PERIMETER (L)

CLS

INPUT “ENTER LENGTH”; L

CALL PERIMETER (L)

END

SUB PERIMETER (L)

P = 4 * L

PRINT “PERIMETER OF SQUARE”; P

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION PERIMETER (L)

CLS

INPUT “ENTER LENGTH”; L

PR = PERIMETER (L)

PRINT “PERIMETER OF SQUARE ”; PR

END

FUNCTION PERIMETER (L)

P = 4 * L

PERIMETER = P

END FUNCTION

20. Display circumference of circle.

REM PROGRAM TO DISPLAY CIRCUMFERENCE OF CIRCLE

CLS

INPUT “ENTER RADIUS”; R

C = 2 * 3.14 * R

PRINT “CIRCUMFERENCE OF CIRCLE ”; A

END

USING SUB PROCEDURE

DECLARE SUB CIRCUM (R)

CLS

INPUT “ENTER RADIUS”; R

CALL CIRCUM (R)

END

SUB CIRCUM (R)

C = 2 * 3.14 * R

PRINT “CIRCUMFERENCE OF CIRCLE ”; C

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION CIRCUM (R)

CLS

INPUT “ENTER RADIUS”; R

CR = CIRCUM(R)

PRINT “CIRCUMFERENCE OF CIRCLE ”; CR

END

FUNCTION CIRCUMFERENCE (L, B)

C = 2 * 3.14 * R

CIRCUM  = C

END FUNCTION

21. Display area and perimeter of rectangle.

REM PROGRAM TO DISPLAY AREA AND PERIMETER OF RECTANGLE

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

A= L * B

P = 2 * (L + B)

PRINT “AREA OF RECTANGLE “; A

PRINT “PERIMETER OF RECTANGLE ”; P

END

USING SUB PROCEDURE

DECLARE SUB AREA (L, B)

DECLARE SUB PERIMETER (L, B)

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

CALL AREA (L, B)

CALL PERIMETER(L, B)

END

SUB AREA (L, B)

A = L * B

PRINT “AREA OF RECTANGLE ”; A

END SUB

SUB PERIMETER (L, B)

P = 2 * (L + B)

PRINT “PERIMETER OF RECTANGLE ”; P

END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION AREA (L, B)

DECLARE FUNCTION PERIMETER (L, B)

CLS

INPUT “ENTER LENGTH”; L

INPUT “ENTER BREADTH”; B

AR = AREA(L, B)

PR = PERIMETER(L, B)

PRINT “AREA OF RECTANGLE”; AR

PRINT “PERIMETER OF RECTANGLE ”; PR

Explanation:

Answered by shivrudrarai
0

Answer:

Explanation:

How to calculate the area and perimeter of a square?

To find the perimeter of a square, just add up all the lengths of the sides. The area of a square: To find the area of a square, multiply the lengths of two sides together. Another way to say this is to say “square the length of a side. In this example, I’ll show how to calculate area and perimeter of rectangle in C.

Similar questions