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

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

範例輸入1:

5

範例輸出1:

  *

 ***

*****

輸入範例2:

7

輸出範例2:

   *

  ***

 *****

*******
[Exercise] Coding (C) - asked in 作業 by (17.9k points)
Available when: Unlimited - Due to: Unlimited
| 56 views
0 0
Called for Help
0 0
Called for Help

45 Answers

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

#include <stdlib.h>

#include <math.h>

int main(void) {
** * ** * *** x,i,j,t=1;
**** ** * *** * ***** ** *** *** **** * * *
***** * ** * ** * * * ** * ** * * **
** ** ****** ** * ** ** *
* ** ****** * * ** ***** *** * *** *** * * * **** ** * * * * * ");
** * **** * *** ****** * * ** * ******** ** * *** ***** * ** *** *
** * ** ** * ** *** * ** * ** * ** ** * *** * * *
* ** * **** *** ******** *** * **** ** * * *
*** *** * * ** *
*** *** ** * ** ** ** ** EXIT_SUCCESS;

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

#include <stdlib.h>

#include <math.h>

int main(void) {
*** * * * ** * * * * x,i,j,t=1;
*** * * * ** * * ** * ** * * * ** ** ***** *
* * * *** ***** ** * * * ***
*** * * * *** * *** *
** * ***** ***** ***** ******** *** *** *** **** **** * ** ** * ** * ");
*** *** ** *** * ** ** * ** ** * *** ** * ****** * * * *** * * * * **** *** *** **
**** * ***** *** * **** *** * ** * ** * * *** ** * * * ** * *
* * ** **** * * * * *** *** * **** *
* ** * * ** * * *
* ***** * ** **** ***** **** EXIT_SUCCESS;

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

int main()

{

   int i, n, k;
* * * * ** * * ** ******** * * * * **

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

   {
** *** * ** **** * ** ** ** * **
*** * * * ** ***** *** * * * * *
** ** ** * ** *** *** * * * * ** * * *** (k=(i-n)/2;k>0;k--)
** ** *** * ** * **** * * ** *** **** * * ** *
*** ** * *** * * * ***** ** * ** ** * * * * * *** * * * * * * *** ** ***
* * ** *** * * *** ** * * ** ** ** * * * * *** *
*** * * *** * * **** ****** * ** * * *** * ** ** (k=1;k<=n;k++)
* * * **** ** * * ** ** ** * *** ** ** ** *
* *** **** * ***** *** **** ** ** *** *** ***** **** ** ** * *** ** *****
* * * * * ** **** *** ** *
* * * * **** * **** ** * * ** *** * *** *
* *** * **** ** *** * * **** *

   }
* * * ** * * * **

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

int main()

{

    int num,i,j,k;
* ***** * ** * * * * * ****** * *** &num);
*** ** ** * ** * ******** **** i<=num; i++)

    {
* *** * * * *** * * ** ** ** * * ** ***** % 2 != 0)
* *** * *** * *** * * * * ** *
* **** ** * * * ** * ** *** ****** *** *** *** *** ** * * * *** j>i; j-=2)
** * * ** ** **** * * * * * * ** * * * * * *** * *
***** * * ** ** *** ** * ** *** ** * * * ***** * *** * ***** ** * * * **** * ** * *** * * * ** ");
** ** * *** ** * * **** *** * * ** *** * ** ** ** ***** * *
********** ** *** ** *** * ******** *** * * ** * *** ** ** * * ***** * ** k<=i; k++)
* * * ******** * **** *** * ***** * ** * ** * **** ** ** ** * *
* * *** * ** ***** *** * * * * ** * **** * * * **** ***** **** * * ** * * ** * * * * * ** * ** ** * * * **
**** * *** * ** * * * * * ** ** * * * ** * * * *** * *
** **** *** *** ** ** * ***** * * * ** * *** * ** ** ** ** * * *** ******
* * ******* ***** ** * * * ** *** *** *****

    }

    return 0;

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

int main()

{
* **** * * ** ****** n,j,k;
* ****** *** ** * ** **** **** ** **
* * * * * * ** * * * * * * * ** *

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



    }




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





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



int main() {

    int i,n,k;
* * ** * ***** * ** *** * *** *** *** * ** *

    for(n=1;n<=i;n++){
* * * * ***** * *** ***** ** * * **** *** % 2==1){
** * * **** * * *** * * ******** **** ** ** * ** * * * ** *** ** **** **** * **** *** *
*** * ** *** ****** * * ** * **** *** * * ******* *** * *** * * *** ** * * * *** **** * * * ");
*** * * * * *** * * * * * * * ** **** ** * ** *
** ** * *** *** * ** ** * ***** ** * ** ** ***** * ** ** **** * *** * ** **** *
* * * * * * **** ***** * ** ** *** * * * * *** ****** * ** * *** * **** * * ******* ** ** *** ****
****** * * * ** * * * * ** *** *** ****** * * ** * * ** * ** * *
*** * * * ** * * * ** * * ** * * **** ** * *** **** *** * * * *** *** *** * * * * ** * * ** * **
**** * *** * *** * * * ** * ** ** * *** **
*** ****** * **** ** * ***** ** * ** ** * * * * **

    }

    

    return 0;

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

int main()

{
**** * ** * * * i,a,b,c;
* **** * * ********* ***** * *
* ** *** * *** * * ** ** * *** *

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

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

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

}


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

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

}


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

}

}


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







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

#include<stdlib.h>

int main()

{
* * ** ** *** i;
** ** ** * **** a;
* ***** * ** * *** b;
* * * * * ** ******* * c;
* ** * * * * * ** ***** * *** ** ***
* *** * *** ** * * *** * ******

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

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

}
*** ** * ** *** *

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

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

}

}
* * *** * *** * * ** **** ***** * *



}


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







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

#include<stdlib.h>

int main()

{
* ** ** * * * * i;
* * *** **** *** a;
** * **** * * b;
*** * ** * ** *** c;
** * **** * *** * * * ***** **
* *** * ********* **** **** ** ***

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

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

}
*** * **** * * ** *

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

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

}

}
** * *** * * *** ** * **



}


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







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

#include<stdlib.h>

main()

{
***** ******** ** i;
* * * ** * * **** a;
* * * * * * b;
* * * ***** ** ** c;
* * ** * ** * ** ** ** **
* *** * * *** * **** *** * * * *

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

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

}
**** ** ** * *

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

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

}

}
** * *** **** ** * ** ** * *



}


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







}
answered by (-190 points)
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.158.78.34
©2016-2018

Related questions

0 like 0 dislike
23 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 作業 by Shun-Po (17.9k points)
Available when: Unlimited - Due to: Unlimited
| 80 views
0 like 0 dislike
67 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 作業 by Shun-Po (17.9k points)
Available when: Unlimited - Due to: Unlimited
| 44 views
0 like 0 dislike
40 answers
[Exercise] Coding (C) - asked Sep 29, 2016 in 作業 by Shun-Po (17.9k points)
Available when: Unlimited - Due to: Unlimited
| 119 views
0 like 0 dislike
60 answers
[Exercise] Coding (C) - asked Oct 13, 2016 in 程式設計(一)AD by Shun-Po (17.9k points)
Available when: Unlimited - Due to: Unlimited
| 49 views
0 like 0 dislike
31 answers
[Exercise] Essay (Open question) - asked Nov 3, 2016 in 作業 by Shun-Po (17.9k points)
Available when: Unlimited - Due to: Unlimited
| 66 views
2,964 questions
57,158 answers
28,936 comments
938 users