sqrt takes double as an argument and also returns double as a return value.

a is defined as float in your program.
and i am not sure, if %d should be used to display a.
if you want to format a, think of other means.

arvind


----- Original Message ----- 
From: "K.Sen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 29, 2002 12:46 PM
Subject: [LIH] sqrt function err


| 
| 
| 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

Reply via email to