4-0. Evaluate the Integer Set that meets the given conditions

Source: Internet
Author: User

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]);
                    }
                }
            }
        }
    }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.