## NVIDIA Interview Question

Software Engineer / Developers**Country:**United States

#include<stdio.h>

#include<math.h>

void main()

{

float a,b,c;

printf("\n enther the number square root who wanna found\n");

scanf("%f",&a);

int i,j;

b=a;

for(i=1;i<10;i++)

{

b=0.5*(b+a/b);

}

printf("\nsqrt of %f is %f\n\n",i,a,b);

}

Float sqrt(float num)

{

Float x;

If(num >0)

{

for(i=0;I<20;i++)

{

x=(x*x+num)/(2*x);

}

Return x;

}

}

float SquareRoot(float num)

- Anonymous May 15, 2012{

if(num >= 0)

{

float x = num;

int i;

for(i = 0; i < 20; i ++)

{

x = (((x * x) + num) / (2 * x));

}

return x;

}

}