C Program to find the Square Root of a number

This is the C program to find the square root of a number using predefined function,use -lm (linking math) for compiling
eg: cc prog.c -lm

[cc lang=”c”]
#include
#include
main()
{
double x;
double y;
printf(“Enter the number for which you want to find the square root n”);
scanf(“%lf”,&x);
y=sqrt(x);
printf(“The square root is %lf n”,y);
}
[/cc]

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *