0 like 0 dislike
5.5k views
請設計一個程式,利用迴圈輸出文字金字塔。

p.s. 輸入皆為奇數,且不大於20

範例輸入1:

5

範例輸出1:

  *

 ***

*****

輸入範例2:

7

輸出範例2:

   *

  ***

 *****

*******
[Exercise] Coding (C) - asked in 作業 by (18k points)
ID: 13736 - Available when: Unlimited - Due to: Unlimited
1 flag | 5.5k views
0 0
Called for Help
0 0
Called for Help
0 0
Called for Help
0 0
Called for Help
0 0
Called for Help

61 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()

{
*** * * * *** ** * ** * floor = 0, i = 0, j = 0 ,k = 0;
* *** * *** * *
** ** ** ** * * * * * * *** * ** * **** * ** * ;
** * *** * * *
*** **** * * ** * ** ** = (k + 1)/2;
* * * **** *** *** ***
* * **** ** * *** * i=0; i<= floor; i++)
* ** * * * ** * *
* ** * * * * * ** * * * * * * j=floor; j>i; j--)
*** ** * ** * ** ******** ** * * * **** * ** ** * **** * ** ** *** ** ") ;
* ***** * **** *** * ** * ** ** ** *** *
** ** * *** ***** **** * ** * *** j=1; j<=i*2-1; j++)
***** * * * *** * * ** ******** *** * ** ** ** * * *** ** * *** * *** * ** * * ;


*** *** ** * * * * * ** * ** ** * * ** * *
** ** *** * * * ** * * **** ****** ** * * *** ****
** * *** * ** **** ** ***** * ** * *

    
*** * ** * ** * * *****

}
answered by (102 points)
0 like 0 dislike
Hidden content!
#include ** * * *

int main()

{
* ** * ****** * ** ** num = 0, i, j ,t;
** * ** * ** * ** ** * **** * *** *** ** * * ;
* * *** * * ** * * ** * = (t+1)/2 ;


*** ** ** ** * * * i=0; i<= num; i++)
* * * * ** * *
* * * **** *** ** * **** * * *** * * * j=num; j>i; j--)
** ****** * **** * * *** ** ** * ** ") ;
* * * ** * ** * * * ** j=1; j<=i*2-1; j++)
* *** ** ***** ** * * * * * * *** *** **** * * ;
* * * * *** ** *** ** ***** ** ** **** * ** ** **** ** ;


** * *** * *** * *

}
answered by (-143 points)
0 like 0 dislike
Hidden content!
#include ****** * ** *

int main()

{
** * * * * ** ** row = 0, i, j ,n;
** ******* * *** ** * ** * * * * * ** * ;
* * *** ** ** ** * * * = (n+1)/2 ;


* * ** ** ** **** * ** * i=0; i<= row; i++)
** ** * **** ** * ** ** *
* ** ** * ** ** *** ****** * j=row; j>i; j--)
*** ** * **** * * ** ***** * ** ** ") ;
* ******** * * * **** ** ** j=1; * ***** j++)
** * ** * ** ** * **** ** ** * ****** * ;
**** * * * * * **** ** ** ** * *** ** * * * ;
* * *** ******* ** *** **

}
answered by (-88 points)
0 like 0 dislike
Hidden content!
#include * ** * * ***

int main()

{
****** ** ****** ** * * row = 0, i, j ,n;
** * * * *** * * * *** * * * **** * ***** ** * ;
** * **** ****** **** = (n+1)/2 ;


** * *** ** ** * * i=0; i<= row; i++)
** * ** * * * ** * *
** ** * ** * * * j=row; j>i; j--)
* * ** * * *** * * *** * **** ") ;
* *** **** *** * ** * * * *** j=1; **** j++)
** * ** * ** * * * ** * * ** * * * * ;
* * *** * * *** j=row; **** j--)
** * * ** * ** **** * * ** **** ") ;
* ** * ***** ** * * ** **** * ;
*** ***** *** * *

}
answered by (-88 points)
0 like 0 dislike
Hidden content!
#include **** * * * * ***

int main()

{
* * ** * * ** row = 0, i, j ,n;
* * * * ** ** **** ** *** ** * * * ** ** ** ;
* * * *** * ** ** = (n+1)/2 ;


** ****** * ** * * * * i=0; i<= row; i++)
*** * ** ** ***
*** ** ** * * * **** j=row; j>i; j--)
*** * ** * * * * * **** ***** ") ;
** ** * ** * * *** **** j=1; * *** j++)
**** ** **** * * * * ** * *** ;
** * * * ** * ** * j=row; j>1; j--)
*** ** *** ** * * **** *** * *** * *** ;
**** **** * **** * * ** * *** ** * * * *** ;
* *** ** ** **** * *

}
answered by (-88 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>



 main ()

{
** ** * ** ** ** * * num,i,j;
* * ** ** * * ** * * *** * * ** ***** ***


** ********** *** * *** i = 0 ; i <= num ; i++ )

    {
** * ** **** ** * ** ** * * * **** * * ** ** j = 1 ; j <= num-i ; j++ )
* * * **** ** * * ** *** * * * * * * **** **
* **** * * * * * ** * * * ** ** ** ** * ***** ** * *** ** * ");
* * * ***** ** * ** * ** ** ** **** *
* ** * ***** * ** * * ** * * * * * * * j = 1 ; j <= i ; j++ )
** * *** *** ** ***** * * *** * ** * ** * **** * * *
* * * ** *** ** **** **** ***** *** ** * *** ** * * * ** * * *** * * * ** * * *** *
* * * **** ***** *** * * * *** *
* ** * **** ** * *** * * ** * * j = 1 ; j <= i-1 ; j++ )
**** * * ** * ** * * * * ** ** *** *****
* * * ** * * *** * * * ** ** *** *** * **** *** * * *** ** * *** * ** * ** ** * * * * *
*** * * * * * **** ***** * * * * * **
****** *** * * * * * * * ****** * * * * ** * * *

    }

}
answered by (-143 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>



 main ()

{
** * * ** ** ** * * **** num,i,j;
** * ** *** ** ****** ***** * ** **** * * * * * ***


* * *** ** * ** * * ** ** ** i = 0 ; i <= num ; i++ )

    {
** *** *** * * *** * * *** * * **** * * * j = 1 ; j <= num-i ; j++ )
** ** ** ** * * * * *** ** ** ** * * * *** *
* ** ** * * * * * *** * **** * ** * * ** ** * * * ** * * ** * **** * ");
* * * * *** * * ***** * * * ** **
* *** * ****** *** ** * ******** **** * * **** *** j = 1 ; j <= i ; j++ )
* * * * * * * **** * * ****** * * * * * *
** ***** * * * **** * * ** * * * **** ** ** ** * ** * * * **** ** * ** *** * * * *
* * **** ** * ******* ***** ***** * * * * * ** *
** * ** * * ** * * * * * ** *** j = 1 ; j <= i-1 ; j++ )
** ** * * *** *** * ******* * *** * ** *** * *** **
* * *** * ** * * *** * **** * * ** ********** * * ** * **** * ** *
* * ** ** * * * **** ** * *** *** **** **
* * * **** ******** * ** * **** ******* * * ********* ** ** * **

    }

}
answered by (-143 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{

    int a,i=1,j,k,l;

    scanf("%d",&a);

    l=a;

    while(i<=a)

    {
* **** * * * ** **** * * ** * ** *** * * ** ** * ** ** * * * *
* *** * * * * * ***** **** *** * * ** ** * *** ** ** ** *** * *
* * ********** * * ** ** * * * * ***** * *** ** *** * ** ** ** * * * *
** * ** **** * ***** *** ** ***** ** ** ** * * * ** ** ** *
**** *** * * ** ** * * **** ** *** ******* * * * * * * * * * * ** * ** * *** * ** *** ");
* ** ** * ** ** ***** ** **** ** * *** * *** * * ** * * *** * * ** *** * ** * ** * *****
* ** * ** ******* * * * ** *** *** * * ** * * ** * **** ** * *
* ***** * * ** ** *** * ** * ** * * ** ******* ** * *** * *
* * * ** * * * * ** ** ** ***** *** ** *** ** *** * * ** ** * ** ** * ** *
********* * ** * * ***** * ** ** *** ** * ****** ****** * ***** ****** *
* * * *** * * ** ***** * * * * *** * * ** ** ** * * * * * * * * **** * *** *** ** * * * **** ** ** * ** ** * *** **
** * **** * * *** * *** ** ** ** *** * * * ***** *** *** ** **** * * **** ** ** ** *** ** *** * * ***** ** * ** ***
* **** * **** * * *** ***** ***** ** * *** * * * ** **
* *** * * ** * ** *** ** ** * * ** **** * ****** ** ** *** * ** * * ****** ****
* * ** ****** * * * *** * * **** * ** * *

    }

    return 0;

}
answered by (-85 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{

    int a,i=1,j;
* ** * ** * ** * ******* ****** * * ** *
* ** **** ** * * * ** * * * * *

    {
* *** * *** * ***** ** ** * * ** * *** * * ***** * * * * ** ** *** * **
* * * ** * ** * * **** *** * *** ******* **** **** *** * * * * * * *
* ** *** * * * * * ** **** * ** ** * * * ** **** ** * ** * *
* * *** ***** ***** ***** * * *** * *** * * **** * * * * * * **** **** ** *** *** * * ** * * **** ****** * *** ** ** *
** * * ** ** * * * ** * *** ****** * * * * ** * * * *** * *** *** **** * * * * * ** * * ** ** * * * **** *
** * ** **** ** * * * *** * * ** * * *** * ********* **
** * *** * ** * ** * **** * ** * ** * * ** * **** * **** * * * ** ** ** **
* * * * * ****** * *** * * * **

    }

    return 0;

}
answered by (-85 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include<stdlib.h>



int main()





{

    int input,b,c ;




* * ******* ** ** ** * *** * * * *** * * **



    for(b=0;b<=input/2+1;b++)

    {
* * ** * ** * * ** *** * *** * ** * ** **** *** **
* * ** **** ** * * *** ***** *** * * * ***** *** * ** ***** ** *** * ** ");}


* ** * * * *** **** * *** * *** * ** ** * * * * * * *** ** * * *** *** * ** * * *
* * **** * * * ** ** * * * **** * * ** ** *** ** ******* * * * **** * * * * ***


***** * ** ** ** * * ** ** * * * *** **** * ** ** * ****** * *** ** *** **** ** * *** * **** **
* * * **** *** ** *** ** ***** * * *** *** ** ***** * ** * * ** * * * * ** ** * ** *** ** * * *** ** **** * *** * ****


** *** * * ** **** ***** * *** **** ***** * *** * * ** * *** ** * ** ** * * *


*** ********** *** * ** **** * *** * ** * * * ***** * ** * ****** *
*** *** ** * * * * * * *** * *** **** * 0;

    }
answered by (-85 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.59.83
©2016-2025

Related questions

0 like 0 dislike
64 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 作業 by Shun-Po (18k points)
ID: 13763 - Available when: Unlimited - Due to: Unlimited
| 5.2k views
0 like 0 dislike
91 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 作業 by Shun-Po (18k points)
ID: 13617 - Available when: Unlimited - Due to: Unlimited
| 7.4k views
0 like 0 dislike
117 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 作業 by Shun-Po (18k points)
ID: 13581 - Available when: Unlimited - Due to: Unlimited
| 8.6k views
0 like 0 dislike
152 answers
[Exercise] Coding (C) - asked Oct 5, 2016 in 作業 by Shun-Po (18k points)
ID: 12295 - Available when: Unlimited - Due to: Unlimited
| 11.1k views
1 like 0 dislike
48 answers
[Exercise] Essay (Open question) - asked Nov 2, 2016 in 作業 by Shun-Po (18k points)
ID: 16865 - Available when: Unlimited - Due to: Unlimited
| 4.9k views
12,783 questions
183,442 answers
172,219 comments
4,824 users