How to use square root in c programming?

1 Answer(s)

The C library function double sqrt(double x) returns the square root of x.
I give you a example below so can know how to use square root in c programing.
The following example shows the usage of sqrt() function.

#include <stdio.h>
#include <math.h>

int main ()
{

   printf("Square root of %lf is %lf\n", 4.0, sqrt(4.0) );
   printf("Square root of %lf is %lf\n", 5.0, sqrt(5.0) );
   
   return(0);
}
Brong Answered on August 23, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.