Area of Square in C

Calculating the area of geometric shapes is a fundamental concept in mathematics. In this article, we going to write the C program that calculates the area of a square.

Area of Square Formula

Area = Side*Side

C Program to Calculate Area of Square

Let’s write a simple C program to calculate the area of a square

Output

Area of Square in C

Explaination of Above C Program

  • #include <stdio.h> is a preprocessor that includes a standard input/output library required for input and output operations.
  • Declare two float variables side and area.
  • Ask the user to enter the length of the side of the square using printf() and scanf().
  • Calculate the area by using the formula mentioned above and store the result in the area variable.
  • At the end print the area by using printf().

See Also

2 thoughts on “Area of Square in C”

Leave a Comment