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’
float len, area;
printf("Enter the Area of the square: ");
// 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);
The above code will generate its output as below.
The length of the square having Area = 25.00 = 5.00