I have a problem using sqrt() in c.
I'm trying to do something like this:
int a;
a = sqrt(9);
etc
I'm restricted to use:
gcc -ansi -Wall -pedantic oneFile.c anotherFile.c thirdFile.c -o outputFileName
How can I make this compile without using the -lm command?
Yes, I have #include !
Is there any way around this and still use sqrt()?
Thanks
just try with this function, If you don`t want to use library.
Sq_root(n)
{
count=0;
int i = 0;
for(i=1;sum<=n;i+=2)
{
sum+=i;
count++;
}
return (count);
}
This will work, without any math library.