Given a positive integer of no more than 6, consider four consecutive numbers starting from. Output the three-digit number of all non-repeating numbers composed of them.
Input Format: Enter a in a row.
Output Format: Outputs the three-digit numbers that meet the condition. The value ranges from small to large. Each row has 6 integers. Integers are separated by spaces, but there cannot be any extra space at the end of the line.
Input example: 2
Output example: 234 235 243 245 253
324 325 342 345 352 354
423 425 432 435 452 453
523 524 532 534 542 543
[Sample Code ]:
# Include <stdio. h> int main () {int A; int I, j, k; int COUNT = 0; scanf ("% d", & A); for (I =; I <A + 4; I ++) {for (j = A; j <A + 4; j ++) {for (k = A; k <A + 4; k ++) {if (I! = J & I! = K & J! = K) {count ++; printf ("% d", I, j, k); If (count % 6 = 0) {printf ("\ n") ;}else {printf ("") ;}}}} return 0 ;}
References:
#include <stdio.h>
int main() {
int num;
int count = 0;
scanf("%d", &num);
int arr[4] = {num, num + 1, num + 2, num + 3};
for(int i = 0; i < 4; i++) {
for(int j = 0; j < 4; j++) {
for(int k = 0; k < 4; k++) {
if(i != j && i != k && j != k) {
count++;
if(count % 6 == 0) {
printf("%d%d%d\n", arr[i], arr[j], arr[k]);
} else {
printf("%d%d%d ", arr[i], arr[j], arr[k]);
}
}
}
}
}
}