1. ## math.h

Code:
```# include <stdio.h>
# include <stdlib.h>
# include <math.h>
int main ()
{
double k;
double x;
printf ("Enter a number ... \n");
scanf ("%f", &k);
x = sqrt (k);
//      x = cos (k);
printf ("Square root is %f\n", x);
return 0;

}```
Error:
/tmp/cc2E1F0F.o(.text+0x3e): In function `main':
: undefined reference to `sqrt'
collect2: ld returned 1 exit status

I am working in linux platform and i do not why do i get this error. I think non of the math.h functions are not working. But I included math.h. any suggestions? 2. I have no problem in compiling your code, I'm using codeblocks with mingw - windows xp. Just a suggestion you must use %lf for the conversion specifier of double. 3. Dial "m" for linking to the math library that contains the definition of sqrt().
Explicitly specify that you need to link in the math lib at compile time, as in
Code:
`cc -lm file.c` 4. Originally Posted by itCbitC Code:
`cc -lm file.c`
While you are at it, I would suggest that you turn on compiler warnings:

Code:
`gcc -Wall -W -pedantic yourprogam.c -o yourprogram -lm`
You might see some helpful stuff like
Code:
```yourprogram.c: In function ‘main’:
yourprogram.c:9: warning: format ‘%f’ expects type ‘float *’, but argument 2 has type ‘double *’```
Watchtower's suggestion tells you how to fix it, but I think it's nice that the compiler can give you a hint that there's a problem so you know where to look (in case Watchtower is not around when you wonder why you get the wrong answer from the program).

D. Popular pages Recent additions math problems, math.h, square root
{"ft_lang_label":"__label__en","ft_lang_prob":0.9113336,"math_prob":0.41270274,"size":597,"snap":"2020-24-2020-29","text_gpt3_token_len":155,"char_repetition_ratio":0.11298482,"word_repetition_ratio":0.0,"special_character_ratio":0.23785594,"punctuation_ratio":0.13114753,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.95623535,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-06-02T15:44:22Z\",\"WARC-Record-ID\":\"<urn:uuid:c2321c7e-bdee-462d-bcd6-e8c1d11055dc>\",\"Content-Length\":\"53795\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:21955cdb-082f-48f5-baa2-c764882e74c3>\",\"WARC-Concurrent-To\":\"<urn:uuid:3f69b998-c8f6-48a5-bb53-f461c7faf45e>\",\"WARC-IP-Address\":\"198.46.93.160\",\"WARC-Target-URI\":\"https://cboard.cprogramming.com/c-programming/117347-math-h.html?s=e1b5ae494992fd89df7276a30efaa149\",\"WARC-Payload-Digest\":\"sha1:ABCQPY4Q2R7RMJ2DHHSLMSVZQQ55J5CW\",\"WARC-Block-Digest\":\"sha1:CW2IJR4P4JZIAZILL4MTEJT7NIQRIUJC\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-24/CC-MAIN-2020-24_segments_1590347425148.64_warc_CC-MAIN-20200602130925-20200602160925-00086.warc.gz\"}"}