Another example;
Code:
/* Goal of this problem is to find out if sqrt of 5 is the same as 5^1/2*/
#include <stdio.h>
#include <math.h>
int main()
{
double five;
double onehalf;
puts("Is the square root of 5 equal to 5 to 1/2 power.. lets find out!");
five = sqrt(5.0);
onehalf = pow(5.0, 0.5);
printf("Square root of 5 = %f\n5 to the 1/2 power = 5f", five, onehalf);
return (0);
}
When i compile:
Code:
gambit:~>gcc powsqrt5.c -o powsqrt5.c
/tmp/ccwe1kyY.o: In function `main':
powsqrt5.c:(.text+0x3a): undefined reference to `pow'
collect2: ld returned 1 exit status
I'm using Ubuntu's standard script writer and Linux terminal logged into my universities system as my complier.