This is a simple and basic C program. It is about Find Area of a Square Program. It calculates and displays area of a square. The user will input only length of one side. Since both sides are equal in a square.
The area of a square can be calculated by the formula as follows:
area = width × height
But we know that the width and height of a square are same. Therefor, the formula becomes:
Area = s 2
where s is the length of one side of a square.
Source Code for “compute the area of a square” C Language Program
/*
C Program to
find the area of a square
*/
#include<stdio.h>
int main()
{
float area, sideLength;
printf(“Enter length of side of square:”);
scanf(“%f”, &sideLength);
area = sideLength * sideLength;
printf(“Area of Square =%f”, area);
return 0;
}