I am currently learning C and i came across an example on for loops but when i try to compile it, it gives me some weird errors, i wanted to know if someone can explain to me what these errors are and how to fix the code so that it works. Here is the code:
Code:
#include <stdio.h>
int main(void){
double angle;
for(angle = 0.0; angle < 3.14159; angle += 0.2)
printf("sine of %.1lf is %.2lf\n", angle, sin(angle));
return 0;
}
Here is the error that i am getting when i try to compile it:
/tmp/ccQOFy9U.o(.text+0x3f): In function `main':
: undefined reference to `sin'
collect2: ld returned 1 exit status
Any help is very much appreciated.