Unresolved:
sqrt
floor
collect2: ld returned 1 exit status
included math.h
Code:gpf = floor(sqrt(y));
Unresolved:
sqrt
floor
collect2: ld returned 1 exit status
included math.h
Code:gpf = floor(sqrt(y));
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
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
using gcc complier in unix
So, did you try
gcc myprog.c -lm
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
just needed to compile wiht -lm thanx