# 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**:

1 2 3 4 5 6 7 8 9 10 11 12 | #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:**

The length of the square having Area = 25.00 = 5.00