1. Square Root??

If i have a number and i want to find the square root of it in a c program how could i go about this.

Thank,

2. The command sqrt() in math.h

3. Thanx guys,

here is the code of the program i made.

-------------------------------------------------------------------------------

/* MADE BY DANGEROUS DAVE 2001 with complments to matt*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void main()

{
float a, b, c, s, u, v, w, x, y, z;
float ans1, ans2;

printf("Progran to find the roots of a quadratic equation useing the B rule\n");

scanf ("%f" , &a);
scanf ("%f" , &b);
scanf ("%f" , &c);

if (b<0)
{
b = b*-1;
}
x = b*b;
y = 4*a*c;
z = 2*a;
s = x-y;
s = sqrt (s);
ans1 = (b+s)/z;
ans2 = (b-s)/z;

system("PAUSE");

}

------------------------------------------------------------------------------

any sugestions would be greatly recieved.

Thanx,

4. Your code erroneous , check the snippet below

if (b<0)
{
b = b*-1;
}

5. Subtraction is easier than multiplication.

if( x < 0 ) { x = 0 - x; }

Quzah.

6. why the 0 ?
why not x = -x ?
anyway his program does not compute the roots of the equation
ax^2+bx+c
the output on the inputs a=1 b=2 c=1 and a=1 b=-2 c=1 are exactly the same due to the above portion of the code , also a=0 is not considered .