zoukankan      html  css  js  c++  java
  • 玩玩

    金字塔一样输出字母,如 输入 d

                 a

             a  b  a

        a  b   c  b  a

    a  b  c   d  c   b  a

     代码实现

     #include<stdio.h>

    int main(void)

    {

            char z;

            int j,t,k;

            scanf("%c",&z);

            t=0;

            if(z>='a'&&z<='z')

            {

                    for(int i=0;i<=z-'a';i++)

                    {

                    for(k=z-'a'-t;k>0;k--)

                    {

                            printf("  ");

                            }

                            for(int j=0;j<=i;j++)

                            {

                            printf("%c ",('a'+j));

                            }

                            for(j=1;j<i+1;j++)

                            {

                            printf("%c ",('a'+i-j));

                            }

                            printf("\n");

                            t++;

                    }

            }

            else if(z>='A'&&z<='Z')

            {

                    for(int i=0;i<=z-'A';i++)

                    {

                            for(k=z-'A'-t;k>0;k--)

                            {

                                    printf("  ");

                            }

                            for(int j=0;j<=i;j++)

                            {

                                    printf(" %c",('A'+j));

                            }

                            for(j=1;j<i+1;j++)

                            {

                            printf(" %c",('A'+i-j));

                            }

                            printf("\n");

                            t++;

      }

            }

            return 0;

    }

  • 相关阅读:
    An easy problem
    Big Event in HDU
    第二个div+css前端项目
    第一个网站前端
    通过jquery.transit.min.js插件,实现图片的移动
    anchor_target_layer中的bounding regression
    faster rcnn结构
    论文灵感
    anchor_target_layer层其他部分解读
    numpy add
  • 原文地址:https://www.cnblogs.com/lucan727/p/3852209.html
Copyright © 2011-2022 走看看