0

I have a problem with unsigned long long int's. I'll tried to do a function wich calculates the factors of an integer. It worked fine with int, but when an tried with unsigned long long int the % and <= operation failed...

here is the surce code for the function

```
void factor(unsigned long long int X){
unsigned long long int i;
int j=0;
unsigned long int fcts[100];
while(X % 2 ==0){
if(X % 2 ==0){
X = X / 2;
fcts[j] = 2;
j++;
printf("faktor %lu och x %lu \n", 2, X);
}
}
for(i=3; i<=X ; i+=2){
while(X % i ==0){
if(X % i ==0){
X = X / i;
fcts[j] = i;
j++;
printf("faktor %lu och x %lu \n", i, X);
}
}
}
for(i=0; i<=j-1; i++){
printf("%d ", fcts[i]);
}
}
```

the forloop should end when i is bigger then X but i doesn't.....Does any one know whats wrong?

thanx!