0 like 0 dislike
16k views

Print this pattern

Input

5

Output

    1
   121
  12321
 1234321
123454321

Input

8

Output

       1
      121
     12321
    1234321
   123454321
  12345654321
 1234567654321
123456787654321

 

[Exercise] Coding (C) - asked in Chapter 6: Loops by (12.1k points)
ID: 31132 - Available when: Unlimited - Due to: Unlimited

edited by | 16k views

58 Answers

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

int rows,i,ii,iii,spaces;

int main()
{
* * *** * * *
** ** * * ** * ** ** * * * **

* ***** ** * ** * ** * ** and output
***** *** **** * ** * *** ** * ***


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

* *** ** * ** *** **** * * ** ** * * ** *** *** part of the triangle
*** ***** * * * ** * **** * *** * * ** *** * * * * *** ** ** ****** * *** *

** *** * ** ****** * * ** ** **** * * * part of the triangle
* ** * ** ** * *** * * ** * *** * * ** * ** * *** * * **** * * ** **

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

    }
** **** * * * * **** * 0;
}
answered by (-254 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main() {
* **** * ***** * i, j, k, rows, count=0;

** ** ** ** * * ** ** * the number of rows\n");
*** * *** * *** * * * * *** * * &rows);

* ** * *** * * ** (i = 1; i <= 2*rows; i=i+2) {
* ***** * * * **** *** *** *** * ** ** * * ** **
* ** ** * **** ** *** ** ****** * * * *** ");
** *** **** * * * *** * ** ***** (k = 1; k <= i; k++) {
* *** * ** ***** ** * * * ***** *** * * * * * ****** * * * '1'+count);
**** **** * * *** *** * * ***** ** <= i/2)
* * ** ** ***** * * * * * ** ******* * *** * ** * * **
* * ** * ** * ***** ** * * * * ** ***
* **** * * ****** * * * * ** * * **** ** * * ** ** * **
** ** * * * ** * * *** ****
* *** * ***** * * ** ***** * * * = 0;
* ** ** **** * * * * * * ** * * * ** * * * ***
   }
* * * * ********* *
}
answered by (-32 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
    int a,level,block,up,down;
    
*** ** * * * * *** * * ******* ** *****
    
** * * * ** *** *** ** * * * * ** ** *
** * * ** **** *** ** * * * ** * **** * * * * ** ***** ** * **
* * ** * * *** * * ** * * * **** * ** ****** * * * ** * * ***** ****** ");
* * * **** * ** * ** * * ** * ** *** * * *** *** *** *** **** *
** ** ***** ** **** ** * * ** *** ** ** * * ** * ** * *** *** *** * *** *** ****
** * *** ** ** * * * * ** * * ** ** * * *** *
* **** * ** * *** * * ****** * ** * **** *** *** * ** * * * ** * **** * ** * *
*** * ** ** ****** ** ** * * * * * ** **** * ***
* ***** ** * ** ** * ** * ** ** * **** ***** ***** *** * ** * **** **

     return 0;
}
answered by (-16 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int n,i,j,a,b;
** ** * ** * **** ** ** **** *** ** *
**** * * * **** *** * * * *** * * *
    {
*** *** *** *** * *** * * *** * ** *** * *** * ** *
****** * * *** ** *** *** ** * ** * ****** ** ** * * * * * *** *** ** * ");

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

** * * * * * ** * * * *** * ** * * * * * ** *** ***
****** * ** ** * ** *** * ** * ** * * ** ****** * * ** * * * *** * *
* * * **** * * * * ** *** * ** * * ***** * * * * *** ******* *** **** **
    }
** *** * * ** ** * ** 0;
}
answered
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
    int n,i,j,a,b;
* ** *** ** ** * * *** * * ** * *** *****
** * ** * * ** * **** ** * * ***** *
    {
* * ***** ** ** ** *** * * ** ** * *** * * *** *** ****
** ** ** * *** * * ******* ***** ** * * * ***** ***** * *** ** * ** ");

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

* * * ******* ** * * * * ** * ** ** * **** ** * * *
* * * * * ***** * * * ** ** * * ** * ** * * **** *** * *** ** * ** * ***
** ** ** * * ****** * ** ***** ** * ** * *** ** * * *** ***** * * *** * *
    }
*** ** * * * ***** * 0;
}
answered by (-281 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include * * * * **
int main()
{
*** ** * * ** int * ****
* ** ** * ***** ** * **** * * *
**** * * *** for(i=1; *** * * i++)
**** * * * * {
* * ** * *** **** for(j=0; ** *** j++)
* * * * * ** ** * **** **** **

*** * ** * **** * * for (k=1; * * * k++)
** * ***** * * ** * * * * ********* * k);}
* * * * * * ** * * *
** ** * * ** * * ** * for (y=i; *** * ** y--)
** * * *** * * * **** ** * ** *** *** ** y);}
* * ** * *** ** *** * **** * * ** ** if (i!=n)
* ** * * ** * * * ** * * * * ** **
** *** * *** }
return 0;
}
answered by (-304 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()
{
    int rows,i,right,left,spaces;
* ***** ** * ** * *** **
* ******** *** * **** * * * * ** * **** * *

* ** *** * * ** * * *** and output
* * * * * * ** * * *** *** *****


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

* * * * **** * **** * * * * **** **** * part of the triangle
*** * *** **** *** *** * ****** **** **** * * ** * ** * ** ** * ** * ** * ** ** ** * *

* * * * ***** * * **** * * **** ********* ** **** ** *** ** part of the triangle
** * ** ** * * * ** **** * *** * * ** * ** **** * * ** **** * *** * * *

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

    }
* ******** ** * * * ** * * 0;
}
answered by (-323 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a,b,c,d,e;
* *** ** **** * *** * * * ** ** * ** * ** ** *
*** * * ** ***** * * *** ** * **
    {
* ** * * *** * * *** ** **** * * * * * * ** * *
* * ***** * * **** **** ** ** * ** ** * * ****** ********* * ** ** ");
****** **** ** ******* ****** * ** * ** * ** * ***** * ****
** **** * ** ** ** ***** *** * ** *** * * ** * * * * ***** *** *
******* *** *** ** *** ** * * * * ** ** * * ** **** **
*** ** * * *** ** **** * * ** * ** ** *** **** * * ** ** * * **** **** * * * *
** * ** ** * * * ** * **** ** * ** *** **
* * * * ** **** *** ** ** ******* *** ** * * ** ****** * * * * * * * **** ** *
    }
**** ***** * ** * *** ** 0;
}
answered by (-498 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
///Pascal's triangle
///Elvis Suazo

#include <stdio.h>
#include <stdlib.h>

int rows,i,ii,iii,spaces;

int main()
{
* * * * * ***** ** *** * * *
** *** * ** ** * **** **** ** *** ** ** **

**** * ** * * * **** ** * ** and output
*** ** * * ** * * **** * * * *** **

*** *** ** * * *** *** **** ******* *** the spaces to make it look isosceles
*** * * * * * *** ** * ** * *** * * ** *** * * * * * ***** ** ** * ** ** ** * * ");}

*** ** * *** * * * * * * ** * * **** **** * * * part of the triangle
* * * * *** * * * *** * * ***** *** *** ****** ** * * ***** * * * * ********* ***

* *** * ***** ***** * * *** **** * * * ** * *** * * * part of the triangle
* * ** * ***** * ** *** ** * **** * *** * ****** * * ** ***** * * ** ** * * * *

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

** ***** * * **
* ** ** * ** ** * * * 0;
}
answered by (-286 points)
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
///Pascal's triangle
///Elvis Suazo

#include <stdio.h>
#include <stdlib.h>

int rows,i,ii,iii,spaces;

int main()
{
** ** ** *** ** ** * *** *
* * * **** **** * ** *** * * * *** *** ** *****

*** * **** ** ** ** ** ** and output
*** * *** *** ** * * **** * * **** *

* * **** * * * ** ** * ** * *** * ** * ** the spaces to make it look isosceles
* * ** *** * *** * *** * * *** * *** * * ** * * * * ** ** * **

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


* * * * * * ******** * *** ** ** ** * * * part of the triangle
* * *** * * *** ** ** ** ** ***** * * ** *** * *** * * * ** * ****

* * ** ** ** * *** ** **** **** ************* *** part of the triangle
* ******* ** ** * ** * ** * * * ** * * * ** ** * * **** ** **** * **

* *** * * ****** * * ** *** *** * * ** **** * *
    }
* * * * * *** ** * * 0;
}
answered by (-286 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:162.159.115.10
©2016-2026

No related questions found

12,783 questions
183,442 answers
172,219 comments
4,824 users