0 like 0 dislike
12.5k 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 | 12.5k views

58 Answers

0 like 0 dislike
Hidden content!
#include<stdio.h>
int main()
{
* ****** * ** *** ** a,b,c,d;
* *** **** * ** *** * * * * * ** ** *** ** ***
for(c=1;c<=a;c++)
    {
** * ***** *** ** *** *** ** * * *
**** ** * ****** * ** * * * * *** **
** *** ** * **** **** * * * * ** ** ** * ");
    }
* **** * ** * * * *** ** ** *****
* *** * * * * *** ** * ** ** ***** ** **
*** * **** *** ** * *** * ** ** ** **** ** ** ***** * ** *
** ** ** *** ** ******* **
* * * *** * ** * * * * ** ****
** *** * **** * *** ** ** ** * * ***
*** ** ** ** **** * * * * * **** * * * *** * * * * ** *** *** *** ** ** * * *
* * ** ** * * ** **** ** *** * * * * * **
if(c!=a)
printf("\n");
** * ** ** *





}
answered by (-329 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,i,j,space;
* * * ** **** ** * * ** * * *** *
    for(i=1;i<=a;i++)
    {
*** * * * * *** *** ** *** * ** *** * * * ** * ** * **** * * ** *
******* * **** * ** * * * * ** * * ** **** ** * ");

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

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

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

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

    }


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

int main()
{
    int a,i,j,space;
** *** ***** * * ** ***** * * * ****
    for(i=1;i<=a;i++)
    {
** * ** * * *** *** ***** * **** * * * * ***** * * * ** *
* * ***** ** * * * * *** ***** * * *** *** ** * ** * ** *** ");

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

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

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

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

    }


***** * ***** * * * * *** *** * ** * ** *** 0;
}
answered by (-167 points)
0 0
prog.c: In function 'main':
prog.c:6:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
     scanf("%d",&a);
     ^~~~~
prog.c:6:5: warning: incompatible implicit declaration of built-in function 'scanf'
prog.c:6:5: note: include '<stdio.h>' or provide a declaration of 'scanf'
prog.c:10:10: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
         {printf(" ");
          ^~~~~~
prog.c:10:10: warning: incompatible implicit declaration of built-in function 'printf'
prog.c:10:10: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:15:13: warning: incompatible implicit declaration of built-in function 'printf'
             printf("%d",j);
             ^~~~~~
prog.c:15:13: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:20:13: warning: incompatible implicit declaration of built-in function 'printf'
             printf("%d",j);
             ^~~~~~
prog.c:20:13: note: include '<stdio.h>' or provide a declaration of 'printf'
prog.c:24:6: warning: incompatible implicit declaration of built-in function 'printf'
      printf("\n");
      ^~~~~~
prog.c:24:6: note: include '<stdio.h>' or provide a declaration of 'printf'
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
    int a,b,space,c;
* * *** * ** * ** * * ** ** * * ** **
    for (b=1;b<=a;b++)
* * * ** *** *** * ** ** * ** * ** * * *
* *** * ** ** *** **** * ** * ** ** (space=a-b;space>0;space--)
* * * * ** * ** ** * * * * ** * ***** **** *** ** *** *
*** * ** ****** * ** * * ** * * * * * **** **** * * * ** *** * *** *** ");
** * * **** * * * ** ** ** ***** * * * * *** * ** *** **** *
* ** **** ** * * *** * * ** **** * * ** * * ***** (c=1;c<=b;c++)
** *** * *** * * **** * ** * * ** * ***** * ******
** * *** ** *** ** *** * ** * ***** ** * ** ** ** * *** * *** * ** ** ** *****
* * ******* ** * **** **** *** * *** * *
* * * * *** ******* * * * ***** * *** * * * ** (c=b-1;c>=1;c--)
** ** * * **** ** * *** ** ** * *** * *** * ** * **
* * ** *** ****** *** *** * ** ******* ** **** *** ***** * * ** ** * * ** *** * * * ***
** ** ** ***** ** ** ** * ** * ** ** *
** ** **** * *** ** * ** *** * ** **** *** * * * ******* ** *** *
* *** * ** **** * *** * ** *** * ** ** ** ** * *** * * ****** ** ** * * * * * ** * ***** * * ****

        }
}
answered by (-229 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,i,j,space;
*** * ** * * ** * ** **** * *** ** * * *
    for(i=1;i<=a;i++)
    {
* * **** *** ** * ***** * **** ****** * ***** * *** ** ** * ** * ****
* ** *** ** * * * * *** ** ***** ***** ** * * **** * ");

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

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

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


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

int main(){
    int i,a,j,k;
* ** * **** ** *** ** * * *** *** ** * *
    for(i=1;i<=a;i++)
    {
* * ** ** ** * **** *** ** ** **** *** * *** ** * ***
** * * **** * ** * ****** ****** * * * * *
* ** ** ** *** * * * ** * * ** ** * ** ** * * *** *** * * * ** ");
*** *** * * * * * ** ********** **** * *** * **** ***
** ** ** * ***** * * ***** ** ******* * ** * * * *******
* * * ** ** * ** **** **** *** * * ***
* * *** * ** ** ** * * **** *** * * * ***** ** * * *** ** * ** * * ***** * * * ****

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

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

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



return 0;
}
answered by (-301 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;
*** * ** *** * * ** ** * * ** **
    for(b=1;b<=a;b++)
    {
***** **** ** *** ** *** * * **** ** ** ** * *
** ******* ** * ******** * * ** ** *****
*** *** ** * ** * ** **** * * *** ** **** * *** * *** ** * ");
** * ******** * * * *** ** * * * ** * *
** ** **** * *** * ** * ** * ***** ** ** * * ** *** ****
** **** * * * ** ** * *** * * *** *** **
**** * * * * *** * *** ***** ** ** * * *** ****** * ***** ** ** * ** * ** *** *
* * ** * ** * *** * ** **** ** * ** ** *
** * * * **** ** ** ** * * ***** * * * *** *
* ****** ** * * ** * * * ** ** ** * ** ***
********* ** **** * ** * ******* * **** *** * *** *** ******* **** * **** * * * * **** * ***
** * *** * * * * ** * ** ** * ** * * * * **
*** ** ************ *** ** ** *** * ** * * * *** *
*** **** * ** ** ** *** * **** ***** * * ** * ** *** *** * * **
    }
    return 0;
}
answered by (-498 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;
* *** *** * ****** * ** ** * * ** * * **
*** * * **** * *** * *
    {
* **** ** * ** * * ** ** ** * ** ****** ** ** ** ** *
* ** * * * * ** ** *** * * ** * *
* ** *** * **** ****** **** * *** ** ** ** ** * *** ** * * * ** * ** * ");
* * **** ** *** * * * * * * *** *
** * * * * ***** *** * *** **** ** * ** * * * ** * ** **
*** * ** ** **** * * *** ** * * *** * ** ** ***** **
* *** ****** * * ** **** * * * * * * * * * * * *** ** *** **** ** **
** **** * ** * ****** ****** *** *** ** ** ****
**** ** * * * ****** **** * **** * * ** * * * ***** *
** *** * ** ** * * * * *** ** * **** *
* * * * * * ** *** * * ** * ***** ** ** * ** ** ** * ** *** * * ** * * ** *
* * * ***** *** ** ** **** **** * ** ** * ** * * *
* ** *** *** ** * ** ** ******** * * *** * * *** * * ** ** ** * **
    }
    return 0;
}
answered by (-498 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include<stdio.h>

int main() {
    int z, h, k, i, j, count=0;
    scanf("%d", &z);
    z++;
    for(h=0;h<=z;h++) {
* ** * **** * * * ** * ** * ** * * ** ** * ** * * {
* **** *** * ** *** ** * **** ** ** * * * * * * ** ***** * * * **
        }
*** ** **** * **** *** * ** ** ** ** {
* ** * ** ** *** * * * ** **** ***** * *********** * * ** * * * * ** * {
* * ****** *** ** * ** ***** ** *** * ** *** *** * * * ** * *** ** ** * ");
** * * **** ** * * *** ***** ***** *** ** *** * * * *** ** * * * **** *
*** * *** * ** * * * * * ** ** * ** * * * * **** *** **** * * *** ** * {
** * * *** **** ** * ***** * ** ******* ** ** * ***** **** ** **** ** *** **** ** * ** **** * * ** ** * i+1);
* * * * * *** ** ********* ** *** ** * ** ** * **
* ** * ** * * *** * * * *** **** * *** *** * * * **** * ** ** {
* ** * *** * ***** * * ** * * ** ** ** ** ** * * * ** * **** * ** * * ******* ** ** *** * * ** *** *** *** * ** j+1);
** *** *** * ** * **** * * * * ** * * ** * * ***** ** *** ** **** *
* * *** ** * * ** *** * **** *** * * * * ** * * ** * ** ** * ** * * * {
* ** *** * * * * * * * ** * * ***** * ** ** * * * *** ****** * *** * ** *** * * **
** * ** ** *** * * * ** * ****** ** *** *** *** ** * * * * *
** * * * * * ** *** *** *** *** ** * ** * ** * ** **** *** *** * {
* ***** *** ** * * *** * * **** * **** *** ******* ** *** **** * * * * ** ** ** **
*** * * * ** ** * ** * ****** * * ** * ** ** * * * * ** ** ** ***
        }
    }
}
answered by (-120 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main()
{
    int x,y,i,space;
* *** * *** ****** ** ** * ******** * ** * * *
    for(i=1;i<=x;i++){
*** * ** *** *** ** * ** * * * * * * *** *** *** *** ** ** **
** ** * ****** * * *** * * ** * ********** ****** ** *** *** ** ***** *** ");
* * *** **** **** * * * ** *****
** *** * * ***** **** ** * *** * **** * * * **
* * *** ***** **** ** ** ****** **** ** * * * * **** ** * * * ** * * *** ***
** * *** * * ***** * ** *** ** * * *
** *** * * *** *** ** * ** * * * ** **** ****** * * * ** * * **
**** * *** * ** ******* * * ** *** * *** *** * ** *** * ** * ** ** *** ** * * ****** * * ** **
* * * **** * * ** * * * * **** ****** **
** ***** * ** **** * * * * *** * ** *** * * * *
*** * ***** ** * *** ** * *** * ** * ** * * **** * **
    }
    return 0;
}
answered by (54 points)
0 0
Case 0: Correct output
Case 1: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.50.51
©2016-2025

No related questions found

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