How to use sqrt() function in C Language

Sqrt() Function

On this page

Sqrt() Function

Program to use sqrt() function in C language

#include <stdio.h>
  #include <math.h>
  int main(void)
  {
    double n, s;
    printf("enter a number :");
    scanf("%lf", &n);
    s = sqrt(n);
    printf("square root of %.2lf is %.2lf\n", n, s);
    return 0;
  }
  

Output

  enter a number :16
    square root of 16.00 is 4.00