Hi
I have written a program, it doesn't work and i can't figure out why.
It does compile, but it doesn't run.
The whole program:
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
int main()
{
int a;
int j;
int c;
int d;
int dig;
c = 0;
int i;
a = 0;
d = 0;
for (i = 0;i == i;i++) {
a = a + i;
// from this
for (j = 1;j < a; j++){
dig = a / j;
if (isdigit(dig)){
d++;
}
//to this doesn't work
if (d == 500) {
printf("%d\n",a);
system("sleep 10s");
}
else {
d = 0;
}
}
}
return 0;
}
The part which doesn't work should count how many divisors the number 'a' has.
What am i doing wrong?