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. You can leave a response, or trackback from your own site. Tweet This! Tweet This! or use to share this post with others.

Leave a Reply: