Hi,
Use %f instead of %d and your code will work.
Sathish.J
>
>
> Hi ,
>
> Here's a sample snip C Code , which is producing erronous results,
> though it is compilimng fine ...
>
> #include<stdio.h>
> #include<math.h>
> int main(){
> float a=100;
> a = sqrt(100);
> printf("\n the Square root of 100 is %d\n\n",a);
>
> return 0;
> }
>
> ------COMPILED WITH ----------
> gcc -o sqroot sqroot.c /usr/lib/libm.a
>
> OR
>
> gcc -o sqroot sqroot.c -lm
>
> Returns : the Square root of 100 is 0
> ------------------------------
> Meaning sqrt() function is not working properly...
> What could be wrong ??
>
> Thanks in Advance,
> Bye
> Kas
>
>
>
> _______________________________________________________________
>
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
>
> _______________________________________________
> linux-india-help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/linux-india-help
>
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help