Hello Guys, this is my first of many many coming posts.
Having this code. i got negative numbers, does anyone know why?.
Code:
#include <stdio.h>
int factors(long int b);
int main () {
long int num = 12345678987;
long int ret;
ret = factors(num);
return 0;
}
int factors(long int b) {
long int i;
for( i=1; i <= 12345678987 ; i++ ){
if( b % i == 0 ){
printf( "Value is: %d\n", i);
}
}
}
Output
Value is: 87558007
Value is: 242072137
Value is: 262674021
Value is: 726 216 411
Value is: -179740967
Value is: -539222901