Computer Science, asked by karismakhan90981, 2 months ago

Write a program to take the side of a square from the user as input and find the area and perimeter of a Square.

Answers

Answered by tanishqbaghel3839
5

Answer:

Below program, first takes length of side as input from user using scanf function and stores in a floating point variable. To find the area of square we multiple the length of side with itself and store area in a floating point variable. At last, it prints the area of square on screen using printf function.

Answered by chouhansantoshkumars
3

Answer:

Write a C program to find the area and perimeter of a square.

A square is quadrilaterals(having four sides) having all sides equal and all interior angles are 90.(right angles). Opposite sides of a square are parallel. A square is a special case of parallelogram where all sides and internal angles are equal.

The area of a square is the amount of two-dimensional space inside the boundary on square. The area of a square can be calculated by placing a square shape object over a grid and counting the number of square units it takes to completely fill a square.

The perimeter of a square is the linear distance around the boundary of the square.

In other words, we can think of perimeter of a square surface as the length of fence needed to enclose that square surface, whereas area is the space inside square surface. Perimeter is measured in linear units whereas area is measured in square units.

C program to find area of square

Area of Square To find the area of a square we multiply it's Side with itself(side square).

Area of Square = Side X Side

Where Side is the length of any side of square.

Perimeter of Square

To find the perimeter of a square, we should add the length of all four sides of square. As all sides of a square are equal, Hence perimeter of square is equal to 4 times Side of square.

Perimeter of Square = 4 X S

Where,

S is the length of any side of a square.

C Program to find the area of a square

To calculate area of a square, we need length of any side of a square. Below program, first takes length of side as input from user using scanf function and stores in a floating point variable. To find the area of square we multiple the length of side with itself and store area in a floating point variable. At last, it prints the area of square on screen using printf function.

Similar questions