JetBlack69
Diamond Member
- Sep 16, 2001
- 4,580
- 1
- 0
Originally posted by: Aznguy1872
The purpose of that loop is to check each j value to modulus with i, but any more then that I am not sure what it idoes..
Originally posted by: JetBlack69
Originally posted by: Aznguy1872
The purpose of that loop is to check each j value to modulus with i, but any more then that I am not sure what it idoes..
according to the code, there is nothing inside the brackets, so nothing gets done in that for loop. Once the loop is done, j is the value i-1, then you are checking if (i % (i-1) ==0)
Originally posted by: beggerking
#include <stdio.h>
int main (void) {
int i, j,SUM=0;
for (i=1;i<10000; i++) {
for (j=1;j<i; j++) {
if(i % j) == 0 {
SUM+= j
}
if (sum == i then) {
printf("%d", SUM);
}
sum = 0;
}
return 0;
};
Originally posted by: Aznguy1872
how come in ur code we declaring that SUM = 0 twice?
