Home > Back-end >  C language code, n1 n2 m three inputs
C language code, n1 n2 m three inputs

Time:11-20

Input n1 n2 m number three, 1 & lt; M<9, if m is not within the scope of output err, n1, and n2 for the digital scope, in turn, the output count from n1 to n2, encounter can be divided exactly by m or number contained in the m number, to _ instead of Numbers separated by Spaces,
The ball ball bosses, children do not come out

CodePudding user response:

 
Void Test (void)
{
Int n1=0;
Int n2=0;
Int m=0;

Scanf_s (" % d ", & amp; N1);
Scanf_s (" % d ", & amp; N2);
Scanf_s (" % d ", & amp; M);

If (m & lt;=1 | | 9 & lt; M=| | n2 & lt;=n1)
{
Printf (" err \ r \ n ");
return;
}

For (int I=n1, j=0; i {
If (I % m==0)
{
Printf (" _ ");
}
The else
{
Int bit=0;
Int num=I;
While (num!=0)
{
Bit=num % 10;
Num/=10;

If (bit==m)
break;
}

If (bit==m)
Printf (" _ ");
The else
Printf (" % d ", I);
}

If ((j + 1) % 10==0)
Printf (" \ r \ n ");
}

Printf (" \ r \ n ");
}

12 210 5
12 13 14 _ 16 17 18 19 _ 21
22, 23 and 24 _ 26 and 27, 28, 29 _ 31
32 33 34 39 _ _ 36 37, 38 41
42, 43 and 44 49 _ _ _ 46 and 47 48
_ _ _ _ _ _ _ _ _ 61
71 62 63 66 67 68 69 64 _ _
81 72 73 76 77 78 79 74 _ _
91 82 83 86 87 88 89 84 _ _
101 92 93 96 97 98 99 94 _ _
111 102 103 106 107 108 109 104 _ _
121 112 113 116 117 118 119 114 _ _
131 122 123 126 127 128 129 124 _ _
141 132 133 136 137 138 139 134 _ _
142 143 146 147 148 149 144 _ _ _
_ _ _ _ _ _ _ _ _ 161
171 162 163 166 167 168 169 164 _ _
181 172 173 176 177 178 179 174 _ _
191 182 183 186 187 188 189 184 _ _
201 192 193 196 197 198 199 194 _ _
202 203 206 207 208 209 204 _ _
Please press any key to continue...
  • Related