I just want to use module operator. But it didn't work.Code:#include <stdio.h> #include <stdlib.h> #include <math.h> #define MAXZO 100 void findMinValue(int n, int *zo, int *tail) { unsigned long i, j, d, zoValue; for (i = 0; i < MAXZO; i++) zo[i] = 0; *tail = (int)log(n); zo[*tail] = 1; do { zoValue = n; i = 0; while (zo[i] == 2) { zo[i] = 0; zo[++i]++; } if (*tail > MAXZO) exit(0); if (zo[*tail+1] == 1) *tail++; for (i = 0; i <= *tail; i++) { if (zo[i] == 1) { d = pow(10, (int)log(n)+1) % n; for (j = i; j <= (int)i/log(n); j++) zoValue = (zoValue*d) % n; } zoValue = (zoValue*pow(10, n-(int)i/log(n))) % n; } printf("%d\n", zoValue); zo[0]++; } while (zoValue != 0); } int main() { FILE *fr, *fw; int n, tail, i; int zo[MAXZO]; fr = fopen("02.dat", "rt"); fw = fopen("02.out", "wt"); fscanf(fr, "%d", &n); findMinValue(n, zo, &tail); for (i = 0; i <= tail; i++) fprintf(fw, "%d", zo[i]); fclose(fr); fclose(fw); return 0; }

Code:mathsniper:~# gcc -O2 -o 02 02.c -lm 02.c: In function ‘findMinValue’: 02.c:24: error: invalid operands to binary % 02.c:28: error: invalid operands to binary %