C. Enter a string of numbers to remove the number containing 7 and the number divisible by 7. Each number is less than 10000, and the number is less than 100.
Input example :,
Output: 1, 2, 45
Note: The number of inputs is uncertain, so it cannot be processed using an integer array. It cannot end with an integer array element equal to \ n, because the array is an integer and \ n is a random type, it cannot be entered.
So we need to use strings for processing. We first take out all integers separated by commas, and then judge and output these numbers.
# Include <stdio. h>
# Include <string. h>
Void main ()
{
Char A [1000000];
Int B [100], C [100];
Int I, J, K, Len, T, flag = 0, len1 = 0;
K = 0; Len = 0; t = 0;
Gets ();
Len1 = strlen ();
For (I = 0, j = 0;I <=Len1; I ++)
If (A [I]> = '0' & A [I] <= '9 ')
{
T = 10 * t + A [I]-'0 ';
Flag = 1;
}
Else if (flag = 0)
Continue;
Else
{
B [J] = T;
J ++;
Len ++;
T = 0;
Flag = 0;
}
For (j = 0, I = 0; I <Len; I ++)
If (B [I] % 7 = 0) continue;
Else if (B [I] % 10 = 7) continue;
Else if (B [I]/10) % 10 = 7) continue;
Else if (B [I]/100) % 10 = 7) continue;
Else if (B [I]/1000) % 10 = 7) continue;
Else
{
C [J] = B [I];
J ++;
}
For (I = 0; I <J-1; I ++)
Printf ("% d,", C [I]);
Printf ("% d \ n", C [J-1]);
}