标题:打印
取消只看楼主
lsp19991127
Rank: 2
来 自:江西
等 级:论坛游民
帖 子:104
专家分:20
注 册:2018-10-30
结帖率:91.67%
已结贴  问题点数:20 回复次数:2 
打印

怎么改成      *
           *  *  *
        *  *  *  *  *
     *  *  *  *  *  *  *
        *  *  *  *  *
           *  *  *
              *
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
    int i,j;
    for (i = 1; i <= 14; i += 1)
    {
        if (i % 2 != 0)
        {
            if (i <= 7)
            {
                for (j = 1; j <= i; j += 1)
                {
                    printf("*");
                }
            }
            else if (i > 7 && i <= 14)
            {
                for (j = 14; j>i; j--)
                    printf("*");
            }
            printf("\n");
        }
    }
    system("pause");                                                                                                                                                                                                                                                                  
    return 0;
}
搜索更多相关主题的帖子: 打印 include int for printf 
2018-11-25 15:56
lsp19991127
Rank: 2
来 自:江西
等 级:论坛游民
帖 子:104
专家分:20
注 册:2018-10-30
得分:0 
回复 2楼 zbjzbj
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
    int i,j,k;
    for (i = 1; i <= 3; i ++)
    {
        for (j = 4; j > i; j--)
        {
            printf(" ");
        }
        for (k = 1; k <= i * 2 - 1; k ++)
        {
            printf("*");
        }
        printf("\n");
    }
    for (i = 1; i <=4; i++)
    {
        for (j = 1; j < i; j++)
        {
            printf(" ");
        }
        for (k = 1; k <= 9 - 2 * i; k++)
        {
            printf("*");
        }
        printf("\n");
    }
    system("pause");                                                                                                                                                                                                                                                                  
    return 0;
}
改对齐了,每个星号之间的空格不会
2018-11-25 16:17
lsp19991127
Rank: 2
来 自:江西
等 级:论坛游民
帖 子:104
专家分:20
注 册:2018-10-30
得分:0 
回复 4楼 zbjzbj
星号后加空格,然后空格加空格就行了
2018-11-26 11:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-491544-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.365981 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved