C Program to Calculate Area of Square

C Program to calculate area of square. The length and area of the square in c programming language for beginners to understand the mathematical ideas in c language

int main()
float length, area;
printf("Enter length of Square: ");
scanf("%f", &length);
area = length*length;
printf("\nArea = %0.2f", area);
return 0;



Enter length of Square:


Area = 25.00

Calculate Area of Square in C

As a result, the area of a square is the product of its two sides. It is also referred to as squares of the sides. Because the area of a square is a product of its two sides, the area unit is in square units.

Float Data Type in C

A float is a data type in computer science that is composed of a number that is not an integer because it includes a fraction represented in decimal format. Some argue that the float data type is used in computer programming when more precision than integers can provide is required.

.2f in C Programming

2f are format specifiers; they begin with a percent sign and are followed by a character that represents the data type. For example, the percent d format specifier is a placeholder for an integer, and the percent format specifier is the same. 2f stands in for a floating point number. Using this program we can execute c program to calculate area of square.