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

58 Answers

0 like 0 dislike
Hidden content!
#include ******** ** *

int ***
{
*** *** * * ** ** ** **** * * * * ** * **** * n;
* * ** ** * * ** * i,j,a;
* * ** * *** * ** ** * * ******* *
** ** * ** * * ** ** * *******
** * ** * * * * * *
* ** * ** **** ** *** * ** **** **** for(j=i; ** ** * j++)
**** ** * ** ** ** * * ** * *** {
* ** * * * ** ** ** * * * ** * * * * * ** ** ** * *
** * ** **     }
** * **   * **** *   for (j=1; * * ** j++)
* * * * *       {
***** *** * ** * ** ******* * * * * ** ** *** **** * * * * * ** * }
* * * * * ** * * * *** * ** for (j=i; *** *** ** j--)
* * * * ** * ** **** * * * *   {
** *** * * * * **** ** *   ** * ** *** ** * *   }
** ** *   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()

{
** * * ***** * * * * input,line=1,space,asc,des;
** * *** * * * * * ***** **** ***** ** * *

** ** * * ** * * * **** *** (line;line<=input;line++)
    {
* ** * * *** *** ****** * ***** * ** ** ** * ** (space=input-line;space>0;space--)
** * *** * * *** ** * ** * ** ** ****** *
* *** ** * * * ** * * * * ** * * * * * * **** * * ** * * ** ******* ** ** ");
** * **** *** * *** ** ** * * *** *
* * ** **** * ** ***** ** * * ** * * * (asc=1;asc<=line;asc++)
* * ** * **** * ** * * * * ** *
*** ** **** * * * *** ** * ** * * ** ** * ** * ** ** * **** * *** * *** * **
**** * * * * *** ***** * ** * ****** * *
** * *** * * * ** ** ** * **** * *** **** * * (des=line-1;des>0;des--)
* * *** ***** ** * ** ** * * * * *** * ***
**** * * * *** *** **** ** * ** *** ** * * **** * * ***** ** * ** * ** * *
* ** ** * * * ***** **** ** * * ******
* ** ** ** * ** ** * * * ** ** (line<input)
**** ** * * * * ** *** * ***** *** ** * *** * * ** *
    }
* * *** *** ** * * * ** * * * 0;

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

int main()

{
* ** * * *** * ** ** * input,line=1,space,asc,des;
**** *** ***** ****** * * * ******* * *****

* **** * **** * *** * * * (line;line<=input;line++)
    {
** **** * *** ** ** ***** ** ** * ** * * * * (space=input-line;space>0;space--)
** * * **** **** *** ** * *** * *** ** ** ** *
** * * * * ** ***** * * *** **** *** ** ** ** * ** * * **** ");
**** * * * *** ** * ***** * ** ** ***
*** * ** ** *** ** ** *** * ** * * *** ****** (asc=1;asc<=line;asc++)
******* ** * ** ** *** * * ** * * * **** **
**** * *** ** *** * ** *** * * * * * * ** ** * *** **** ** ** * ** * **** ****
* ** ***** * * *** ** *** * * * * * ******
* ** * * ** ** * ** ** ****** * ** ** * * * * * ** (des=line-1;des>0;des--)
* *** ****** ** * * **** * ** * ****
** ** * *** *** ** * ***** ** * ** * ***** ** ***** ** ** ** *** * ** ** ** ** * * ** * *
*** * ***** * * ** *** *** * ** ** *** * *
*** * *** * ** * * ******* * ** ** ******* ** ** *** * *
    }
*** *** * ** **** * * *** * 0;

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

int main(void)
{
* **** ******* *** *** * * i, n, j,count=0, k;
* ** * *** ** ** * ** *** ** ****
 for(i=1; i<=n; i++)
* *** * * *** * *
        for(k=i; k<n; k++)
* ***** *** * *** ** ** * ** * * * * ** **** * *
* * * ** ** * ** * * ** *** **** * ** ** **** ** * * *** ** * ");
****** * * * * ** * * * * * * ** ** *** * * ***
** *** ******* * **** ***** * *** *
* * * *** ** ** ***** * * * ** *** **** * j<=i; j++)
** * ** *** ************* **** *** * * * * **
* *** * ***** *** * *** * **** ** **** ** ** * * ** * ** * * * * ****** * ******* ***** * j);
* *** ** ** *** ****** ** * *** ** * * ***

* ** * **** **** * * * * ** * j>=1; j--)
**** * * **** *** ***** ** * *** * *** * **
* ** * ** * *** * * * * ** *** ******* ** * *** * * * * * * * * * * * * * j);
*** ** * ** * * ** **** * ** * *** * *

***** * *** *** *** (i!=n)
* *** * ** *** **** ** *
    *********** * * *
   
       
*** * ** * * *** * * * ***
* * * **** * * * *
** * * **** ** **
   
* * * ** ** ** *** * 0;
}
answered by (-304 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
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 input,n,space,asc,des;

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

** ** ** * *** * * *** (n=1;n<=input;n++)
    {
* * * **** * * * * * * ** * * ** ** ** (space=1;space<=input-n;space++)
*** * * * ** * ** * * *** * * ** * ****
** ** * * **** * ** **** ** * ***** ** ** * * * ** * * * ** ** ** ");
***** * * * * * **** **** ** * ** * * ** **
*** * * *** ** *** *** ** * *** **** * (asc=1;asc<n;asc++)
** *** ** ** * *** ** * * ** *** ****** * * *
*** * **** * * * * * * * ** *** * *** ** ** * ****** ** **** * *** * * * * ** * *
* **** * * ** **** * ** *** **** * *** *** **
** ** * * ** *** * ** * *** *** ** * * * * ** (des=n;des>=1;des--)
****** ** * ** * * ***** * ** *** ***
* * * *** **** ** * ** ** * * *** *** ****** * * ** ** * ** *** * ** * ** * *** *
* ** * * ** * ** * * * * ** * * ******
* * ** * ** * * * **** ** * ** * *** ** * (n<input)
* **** ****** * ** ** * * * * * ** * * **
    }
* ** * * ****** *** *** 0;


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

int main()

{
    int input,n,space,asc,des;

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

** ** * * ** * * * ** (n=1;n<=input;n++)
    {
***** ** ** * * * *** * *** ** ** ** * * (space=1;space<=input-n;space++)
* * * ** * ** ** * * * **** ***** ** * ** *
* ** ******* * * * * *** * * * *** * * ***** * * *** * ");
* * * * **** *** ** ******* * ** ** **
* ** * ** * * ***** *** * * * *** * (asc=1;asc<n;asc++)
* * * * * **** * ***** * * ** * ** ** * *
** ** ***** * ****** * *** *** ***** ** ** * * ******** ** * *** ** * *** * *** * * *
**** * **** * ** ****** ** ** * *
*** ** * * ** * * * * * **** (des=n;des>=1;des--)
** * * ** * * * ** * * ** * ****** *** ** *
** ** * *** * * ** ** * *** * * ** * *** * * ******** *** * ** *** * * * * *
*** * ** * **** * * * *** * ** *** * * **
* ** ** ** ** * * * * * * **** * ** *** **** ***** * ** * * ** *
    }
** * *** * * ***** ** 0;


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

int main()

{
** * * * *** ** ** ** * ** ** input,n,space,asc,des;

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

    for (n=1;n<=input;n++)
    {
**** ** * * ***** * *** ** ** ***** ***** ** * ** (space=1;space<=input-n;space++)
* ** ** * ** * * ******** * *** * ** ** *
**** * ** ** * * * ** * **** *** *** **** ** * * * ** * * * ** * * **** * * **
**** * * ** ******* ** * * *** ** ** * * **
* * * * ****** * ** * * **** *** * ** * * * * * (asc=1;asc<n;asc++)
* ******** * * *** * * * * ** *** *** *
** ** * * *** **** *** ** ** * ******* ** *** ** * ** * * ** *** ** * ******** ** *
** *** ** ** * * * ** ***** *** **** **
* * ** * ** * * ** ** * * *** * ** * (des=n;des>=1;des--)
** ******** * ** * ***** * * * * * ** * *
* *** * ********* * * * * * * * * ** ** *** * ** ** *** * ***** * ** ** ** * ** * *****
** ** ** ****** * * * * * ** * **** **
** * * * * * * * * ** **** ****** * *** *** * * ** * * * ***** *
    }
**** * ** * ***** *** * * 0;


}
answered by (-249 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
* * ** * *

int main ()
{ * * **
* * * * ** int n, c, d, num = 1, s;
*** ** * *
* * ***
* *** * ** ** **** ** ****** *
* * ** **
**
* ** * * ** s = n - *
* * *** ** for (d = 1; d * * n; d++){
*** * ** * *** * ** * num = 1;
** * ** ** * * * ** * for (c = 1; c * ** s; c++)
* * * **** * * * * * * *** * * ** * * ** * ***** ****** *
** * ** ** * * ** * * s--;
* * * ** * ****** ** for (c = 1; c * d; c++)
* * **** ** * ** {
* *** ** * ** ** * * * * ** * *** * * * * * * ***** * ** num);
*** *** * ** * * * * * * * * *
* ** * * * *** ***** }
** * * ** * ** ** ** * * **
**** * * * * ** ** * * ** for (c = 1; c ** ** d; c++)
* ** * * *** **** ** ** {
**** * * * ** * * **** ** **** ** *** * ** * num);
** * * * ** **** ****** *** ** * *
* *** ** * * ** * * * ** ** }
* * ** * ** * * * ** **** * * *
** * * * * }
*** * * * *** 0;
}
answered
0 0
Case 0: Wrong output
Case 1: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
int main()
{
*** ***** ** ** * ** * n,i,a,b,c;
**** ** ** * *** * ****** ** *** * * * * * **

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

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

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

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

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

* * ** * * * * * * 0;
}
answered by (-281 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:108.162.216.32
©2016-2025

No related questions found

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