day.1

作者: 今生何求惟你 | 来源:发表于2018-06-11 13:15 被阅读1次

    为了学好c语言,以后每天坚持写代码

    给三个数abc,每个数的取值是1-4,组成多少个互不相同的三位数?并输出。

    #include  <stdio.h>

    main()

    {

    int a,b,c,i;

    i=0;

    for(a = 1;a < 5;a++)

        for(b = 1;b < 5;b++)

            for(c = 1;c < 5;c++)

            {

    if(a != b&&b != c&&a != c)

        {

    printf("%d%d%d\n",a,b,c);

    i++;

        };

        };

    printf("total is %d",i);

    return 0;

    相关文章

      网友评论

        本文标题:day.1

        本文链接:https://www.haomeiwen.com/subject/botheftx.html