# C program to compute the length of square when area is given

For a better understanding of this tutorial, you need to have the prior knowledge of the C Standard Library in detail. Here, you will see how we can use the standard library functions in our program for its execution. We can also use our own process for finding the length of the given square when its area is given. But the process will be too long and takes on numbers of execution times of CPU so it delays the process too. So in order to maintain efficiency and optimization of the code, we will use the sqrt() function which falls under the header file ‘math.h’

Code:

#include <stdio.h>
#include <math.h>
int main()
{
float len, area;
printf("Enter the Area of the square: ");
scanf("%f", &area);
// Computes the length of the given sqaure having with given area.
len = sqrt(area);
printf("The length of the square having Area = %.2f = %.2f", area, len);
return 0;
}

The above code will generate its output as below.

Output:

Enter the Area of the square: 25
The length of the square having Area = 25.00 = 5.00
SHARE C program to compute the length of square when area is given

#### You may also like... 