Unresolved:
sqrt
floor
collect2: ld returned 1 exit status
included math.h
Code:gpf = floor(sqrt(y));
Printable View
Unresolved:
sqrt
floor
collect2: ld returned 1 exit status
included math.h
Code:gpf = floor(sqrt(y));
code might help.
Code:int PrimeFactor()
{
int y;
int fact;
int r,i;
int num1, num2, gpf, Prime;
y=GetNum(num1);
{
Prime == 1;
gpf = floor(sqrt(y));
for(fact=2; fact <= gpf; fact++)
{
while( y % fact == 0)
{
if(Prime==1)
{
printf("%d = %d", y, fact);
Prime == 0;
}
else
{
printf(" * %d", fact);
y = y/fact; }
if(Prime == 0)
{
printf("%d is a prime number.", y);
}
else
if(y!=1)
{ printf(" * %d", y);
printf("\n\n");
}
else
{
printf("The Prime Factors for this number are\n");
printf("%d = ", y);
}
for (i=2; i <=y; i++)
{
while( y % i == 0)
{
y = y / i;
} printf(" * %d",i);
}
}
}
printf("\n\n");
}
}
Have you tried linking with your math library?
What compiler are you using?
Maybe you need to add -lm when you compile
using gcc complier in unix
So, did you try
gcc myprog.c -lm
just needed to compile wiht -lm thanx