1.输入一些数,并把比0大的和比0小的区分出来

#include <stdio.h>
#include <windows.h>
int main(char argc, char * atgv[])
{
    int ele[10];
    printf("请输入数字:\n");
    for (int k = 0;; k++)
    {
        printf("\n输入第%d个数:",k+1);
        scanf("%d",&ele[k]);
        if (k == 9)
        {
            Sleep(2);
            printf("可以了 别输了\n");
            break;
        }
    }

    int big = 0;
    printf("\n比零大的数:\t");
    for (int i = 0; i < 10; i++)
    {
        if (ele[i] > 0)
        {
            big++;
            printf("%d\t", ele[i]);
        }
    }
    printf("总共有%d个数\n",big);
    int small_1 = 0;
    printf("\n比零小的数:\t");
    for (int j = 0; j < 10; j++)
    {
        if (ele[j] < 0)
        {
            small_1++;
            printf("%d\t", ele[j]);
        }
    }
    printf("总共有%d个数\n", small_1);
}

2.用1234四个数,组成每位不重复的三位数

#include <stdio.h>

int main(char argc,char * atgv[])
{
    int element[4] = {1,2,3,4};
    int a, b, c;
    int value;
    for (int i = 0; i < 4; i++)
    {
        a = element[i];
        for (int j = 0; j < 4; j++)
        {
            b = element[j];
            for (int k = 0; k < 4;k++)
            {
                c = element[k];
                value = a * 100 + b * 10 + c;
                if(a != b && b != c && a != c)
                {
                    printf("%d\r\n",value);
                }
            }
        }
    }
}
01-11 07:09