2018年7月23日日报

姓名:任光烨 日期:2018年7月23日

今日学习任务:学习数组函数等,趣味编程8,9题。

今日完成情况:都已完成,<100行代码。

今日开发中出现的问题汇总:无。

今日未解决问题:无。

今日开发收获:

自我评价:

其他:趣味编程8,9题

8:

#include<stdio.h>
int main()
{
    int a,b,c,count=0;
    for(a=1;a<=5;a++)
    {
        for(b=1;b<=5;b++)
        {
            for(c=1;c<=5;c++)
            {
                if(c!=a&&c!=b)
                {
                    printf("%d,%d,%d\n",a,b,c);
                    count++;
                }
            }
        }
    }
    printf("总共有%d种可能",count);
    while(1);
}
 

9:

扫描二维码关注公众号,回复: 2355933 查看本文章

#include<stdio.h>
int c(int x,int y);
int main()
{
    int i,j,n=13;
    while(n>12)
    {
        scanf("%d",&n);
    }
    for(i=0;i<=n;i++)
    {
        for(j=0;j<12-i;j++) printf(" ");
        for(j=1;j<i+2;j++) printf("%6d",c(i,j));
        printf("\n");
    }
    while(1);
}
int c(int x,int y)
{
    int z;
    if((y==1)||(y==x+1)) return(1);
    z=c(x-1,y-1)+c(x-1,y);
    return(z);
}

猜你喜欢

转载自blog.csdn.net/qq_37624987/article/details/81172834