C Reference function sqrt()

Usage of sqrt():

double sqrt(double x);

Parameters:

The argument cannot be negative.

Return value:

The returned value is always positive.

Source code example of sqrt():


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

	main()
	{
		double input, output;
		input = 256.0;
		output = sqrt (input);
		printf ("sqrt(%lf) = %lf\n", input, output);
		return 0;
	}

Output of the sqrt example program above:


	sqrt(256.000000) = 16.000000

This entry was posted in C Reference math.h Functions. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed. Tweet This! Tweet This! or use to share this post with others.

Comments are closed.