2 like 0 dislike
1.9k views

By using two-dimensional array, write C program to display a table that represents a Pascal triangle of any size. In Pascal triangle, the first and the second rows are set to 1. Each element of the triangle (from the third row downward) is the sum of the element directly above it and the element to the left of the element directly above it. See the example Pascal triangle(size=5) below:

使用二維陣列,寫一個顯示巴斯卡三角形的程式。

Example input1:

5

Example output 1:

    1
   1 1
  1 2 1
 1 3 3 1
1 4 6 4 1

Example input 2:

0

Example output 2:

0

 

[Exam] asked in Final Exam
ID: 42301 - Available when: 2018-01-17 14:00 - Due to: Unlimited

retagged by | 1.9k views

31 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>
 int main(void)
 {
     int i,j,k,n,a[100][100];
** * ** * * *** * ** * * * *** * *
     if(n==0)
*** * * ********* ** *** * * * ** * * ** ****** *
     else
     {
*** * * **** * * ** *** ****** ** ****** ** ** * ***** * **
         {
** * * * **** * * * *** * * ** * *** *** * * *** ** ** ** ** ** ** * ***
* *** * ** *** * * ** * *** * *** * * * ** *** * * * * * **
****** * * ** ** ******* *** * * ** *** ** ** * ****** ** ** **** *** ** * ** * ** ****** || j == i)
** *** * *** ** ** *** ** ***** * * * ** *** *** * *** * * ** * * ** * *** * ** *** ** ** **** = 1;
** * **** * **** * *** ** ****** * ********* * * * * * *** * *** ** ** * ** * ** ***
* **** ** ***** ** **** * * * ** * ****** ***** ** * * **** * ****** * * * *** ***** *
*** ** * * * * * **** * * * **** *** ** * ** * * * *** ** * ** * ** * ** * ** * * * * * *** ** * *** * ** ** = a[i-1][i-j] + a[i-1][i-j+1];
*** * ** *** **** * ** * * * ** ****** ** * * * *** * ***** *** ** ****** * *** * *** * * *
* ********* ** * * * * **** * **** *** * ****** ** * ** *** * **** *** ***
         }
** ** * ***** *** ** * *** ** * ** **** ***** * * ** * i<=n;i++)
         {
*** * ** * *** * ***** * * ***** * *** * ** * ** **** * ** * * * ** * ** * * *
* * **** * * * ** * *** **** ** ** **** ** * ** * * * * * * * * * * * *** ****** * * * ** * * *** ");
* ** ** ** * * ** * ***** * * * ******* * ** * * *** * ** *** ** ** * * * j<=i ;j++)
** ***** ** *** ** **** * ** *** * *** ******* * * *** **** ** * ** * * ** ** *** ** * * **
* * ** ** * *** * ***** ******** ***** ** *** * * * * *** * * * ****** * * *** * * * * * * * * * * *** ** *** * * * ** ***
** *** ** * * * * ** * *** * ** * ** ** ** ******** **** * ** *** *** ** *** * * * ** * * ** * *
****** ***** ** ** **** ** **** ** * * * *** ** * * **** * * * *** * *** *** *** * *** * *** *** **** * **** * ** ** * * *** * ** ** ** * * ** ** * ");
* ** * * * ****** ** ** ***** * * **** ** * * *** * ** * *** **** * * * ******* ** * *** *
** * * * ***** * *** **** * * ** ** * * **** * ** ** * *** ** * * *
* * * *** ** ********* * * * * * *** * ** * * **** * ** * ** *** **** ** ** * ***** **
         }
     }
     return 0;
 }
answered by (-281 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
* * ** ** * ***
int main()
{
* * * * ** *** * ******* * * n;/*
* ** **** * ** ** * ** * * * * * ** * **** ******** ** ***
**** * * ** *** **** * c[10]={};
**** *** ** **** ****** * * i=0;
******** * * ** * *** * * * ** * * *
***** * *** * ** * * *** * * * * ** * *** * **
* * * ** * ** ** ** * ** ** *** *** * * ** ** *** ",c[i]);





* *** **** ** * * *
*** *** **** *** * * *** * * ** * * ******
* **** *** * * * * ****** * **
* * ** ** * ** ** *** ** * * ** * ** *** ** * * *** * **
* * ** * **
** * **** ** * *** ** * * * ** if(n==1){
* * ** * * * ** * *** * **** *** * ** ** * ** * ** ** *
* * * * * * ** *
*** * * ** * *** if(n==2){
* * * **** * *** ***** * * ** ** * ****** * * 1\n");
**** ** * * ** * * * * * * * ** *** **** * * * 1");
** ** * * **** *** ** *
***** * * * ** ******* * ** if(n==3){
* ** ** ** * * * *** * ******** * * * ** * *  1\n");
* ****** ** **** ** ** * * * * * * * ** * * 1 1\n");
* * * * **** * * * * * ** **** * * ******* * 1 1");
* *** * * ** * * ***
* * *** * * * *** * if(n==4){
*** * * *** * * * ** *** **** ******** ** **
* ** * *** * **** * * * ** *  1 1\n");
* *** * * **** ** ** * ** ** * * 1 2 1\n");
** * ***** ** *** * *** * * * * *** 3 3 1");
* *** * * ** ** * * * *
** * *** *** ***** *** if(n==5){
***** ** * * ** ** * * * ** * ** ****** *** * ** * *
** ** ** ** * * * * ** ** **** *** *   1 1\n");
* * ** *** ****** * * *** ** * * **** *  1 2 1\n");
* ** * * *** * * * * ** **** 1 3 3 1\n");
**** ** ** ***** * * * * * *** * ***** 4 6 4 1");
* * *** *** *** * *
* * ** * * * **** if(n==6){
*** * ** ** *** * *** ** ** * * * * * * * ******* ** ** ** ** *
** * * * * **** *** * ** * *    1 1\n");
******* ** *** ** * *   1 2 1\n");
* * * ** **** * * **** * * ***  1 3 3 1\n");
**** * * * * * *** * ** *** * * 1 4 6 4 1\n");
* ** ********* * ** * * * * 5 10 10 5 1");
* **** ** **** *
* * ** * *** ** **** * if(n==7){
*** *** * * * * * * ** ** ***** *** * * * ***** ** * * ****
* * ****** * * ** * * * * * * * 1\n");
****** * * * * * * *** **** * **** ***** ** 2 1\n");
* ****** **** ** * ** * *   1 3 3 1\n");
** *** ** * * * * *** * * * **** *****  1 4 6 4 1\n");
* * ** ***** * ** * * * ** * * * 1 5 10 10 5 1\n");
* *** * **** ** * ** ** * * * * 6 15 20 15 6 1\n");
*** ** * * *
* **** ** ** * if(n==8){
* * ** * *** **** * * **** ** * * * **** *** * * * ****** * ** ***
** ** * * *** *** ** * * ** ** * * ** * ** ** * * * 1\n");
* * ** * *** * * * ** * *** * * * ** ***** * * * 2 1\n");
** * * ** *** * * ** ****** * * *** * **** * **** 3 3 1\n");
* **** * ** * **** *** * ** ***   1 4 6 4 1\n");
**** * *** * * ** ****** ***  1 5 10 10 5 1\n");
*** * * * ** * *** ***** 1 6 15 20 15 6 1\n");
* * *** * * * * * * * 7 21 35 35 21 7 1");
*** * * ***** ** ** * **
*** *** * ** ** * * *
* **** * * ** ** *




* ** * ************ ** **** ** * if(n==9){
** * * * * * ** ** ** ** * ** * * * *** * ** * **** ** *** *** **** * ***
* * * ** * ** * * ***** * ***** * * *** * *** * * * ** ** *** ** 1\n");
*** *** * ** * ** ** * * * ***** *** *** * * * * *** ** * 2 1\n");
** * * ** * * ******* *** ***** * ** * * ** * ** * 3 3 1\n");
* * ** * ***** * * ***** ** * * ** * * * 4 6 4 1\n");
* * ** * * ** * ** ** ** ** *   1 5 10 10 5 1");
* ** *** * * **** * * * * * ***  1 6 15 20 15 6 1\n");
**** ** * * ** ***** * * * * 1 7 21 35 35 21 7 1\n");
***** ** **** * * *** ****** * 8 28 56 70 56 28 8 1");
** ** * ** *** ** ** ***







}
100/100 answered by (-329 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Wrong output
0 0
prog.c: In function 'main':
prog.c:17:17: error: 'n' undeclared (first use in this function)
     scanf("%d",&n);
                 ^
prog.c:17:17: note: each undeclared identifier is reported only once for each function it appears in
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Wrong output
0 0
prog.c: In function 'main':
prog.c:88:12: warning: missing terminating " character
     printf("1 8 28 56 70 56 28 8 1);
            ^
prog.c:88:12: error: missing terminating " character
     printf("1 8 28 56 70 56 28 8 1);
            ^~~~~~~~~~~~~~~~~~~~~~~~~
prog.c:89:5: error: expected expression before '}' token
     }
     ^
prog.c:89:5: error: expected ';' before '}' token
0 0
prog.c: In function 'main':
prog.c:88:12: warning: missing terminating " character
     printf("1 8 28 56 70 56 28 8 1);
            ^
prog.c:88:12: error: missing terminating " character
     printf("1 8 28 56 70 56 28 8 1);
            ^~~~~~~~~~~~~~~~~~~~~~~~~
prog.c:89:5: error: expected expression before '}' token
     }
     ^
prog.c:89:5: error: expected ';' before '}' token
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Wrong output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
    int n = 0;

    scanf("%d", &n);

    int a[n + 1][n + 1];

    int i = 0;

    int j = 0;

    if(n == 0)
    {
* * * * ** * * * ** * * *** * * ** ** * ** * * * * ** ** **
    }
    else
    {
** ** *** ** * * ** * * * **** ** ** *** = 0; i < n + 1; i++)
* ** ** ** *** * ** * * * * * ** * **** * ****
*** * * * * * * * ***** *** * ***** * ** *** ** ** **** * * * = 1;
* ** * *** * * ***** ** * * * ** **** ** * * * * * * * * ** ** ** ** * = 1;
** *** * ** * * * * **** *** *** **** **

** * * * ** * * * *** * ** * ***** = 2; i < n; i++)
*** ***** **** *** *** * **** * * ***** *
* ** * ** **** * ***** ******* * * * * * *** * *** * ** * = 1; j < i; j++)
* ***** * ** * ** *** * * ** * * ** * ** ** *******
* * ****** ** * ** ** **** * **** **** * *** * *** * ** * *** ** *** * *** ** * * * * * * = a[i - 1][j - 1] + a[i - 1][j];
** * * *** * ** * * *** * ** * **** * * ** ** * * * ** * * * * * *
** ** **** ** * * * * * ** **** * ** *** * *

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

*** * * * * * ** * * * ** *** ****** ** * * * * * *** * ** = n - 1; j > i; j--)
* * *** * ** * **** * *** * ******* * ** * * * ****** * *
* * ***** ** * * *** ** ** * * * * * * ** * ***** ** ***** *** ** * * * * * * * * * * ");
* **** * * *** ** ** *** * ** ** *** **** * ** ** ** * * ** ***

* ***** ****** * ** * *** * **** ** * *** *** ** * * * ** * * *** ** = 0; j < i + 1; j++)
* * ***** * * *** * * *** ***** * **** * ** * ***** ** ** **** **
* * ** ** ** *** ** * * **** *** **** * * *** *** * * ***** ** * *** ** ** ***** * ** < i)
* * * * ** * ** * * * ** ** * * * * ** ********* * *** ** ** ** * * * * * ** * ******
* * * * * * * * **** *** *** ** ****** *** * ** ***** ******* * * ** * ****** * * ** *** * * *** * ** ** * * ", a[i][j]);
* ** ****** * ** ** ****** *** * * *** * * ** ** * ** * * * ** * * * * ** ***
***** ** * * * * * * ****** * ** * ** *** *** * *** * * * ** ***** *** * *
*** ** * **** ** * * * *** ** ** *** ** * * * * * **** * *** * ** * *** * *
* *** * * *** **** * * * * ** * *** * * * * ** * * * ** **** **** ** * * ** ** ** * * * ** **** * *** * *** ** ** ** * *** * ***** * a[i][j]);
* ** **** * ** *** * * *** ******* **** ** * ** * * ** *** * ** * ***** *** *

* **** *** * * * * *** * ** * * ** *** * * * ** * * ** ** **** ** * * *** **** == j && i != n - 1)
** ** * * ** ***** * *** * ** * * * ** * ** *** * **** *** ** ** * *** ** *** * ** **** **
* *** **** ** **** *** *** ** * * * * **** * ** *** ** ** ** * * * ** * * * *** ** * * * **** * * *** ** *
* * * * ****** * * ** ** ******* * **** ** * *** * ** **** ** **** * **** ** * ** ** * * *
* ** * **** ** ** ** * * *** * *** * * * * * ** *** ** **

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

int main()
{
 int n;
 int i,j,k;
 int pas[100][100]={0};

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

 if(n==0)
 {
* *** ** * ** * ** * * ***** * ** * * *** * *
 }
else{
 for(i=0;i<=n;i++)
 {
** ** * * **** *** * * * * **** * ** *
* * *** * * * * ** ** *
** *** * *** ********* * * * *** * *** * ** ******* * ((j==1) || (j==i))
**** * ** * * ** ** ** * ** ** ** * **** * ****
*** * * ***** ** ** *** * * * **** * * * ** ** **** * * * * *
*** ***** *** * * * ** ** * **** ** *
***** * ** * ** **** ** * ** * ***** ** ** * ** *
* **** ** * * * * ***** *** ** * ** * * ** ** **
* * *** ** *** ** * * ** * * ** ** ** * * * ***** *** * ** * ** * *** ***** *** ****** * * * **
* **** * *** * ** * **** * * ** ** *** ** ** ** ** * * *

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

 }

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

* * *** * * ** ** * * * * ** ** ",pas[i][j]);

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


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

* * * ** *** *** ******* ******* != 1)
** **** * * * * * ** ** ****
* ** * * *** ** *** *** ** * ** *** * ** *** **** * * * * *
     }
 }
}
    return 0;
}
answered by (-193 points)
edited by
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Wrong output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main ()
{
** ** * * ****** * * * * n;
** *** ** * ****** * *** **** *** ***
*** * * *** * * * * ** *** ** **** * * **
** ** *** * *** **** * * * *** ** *
* ** * * *** ** ** (n==2){printf(" 1\n");
* * ** *** ** * **** ** ** * ** * ***** * * * * * ** * ** *** * ** 1");}
*** * **** *** * * ** * (n==3){printf(" * *** ** *
* ** * ** **** * *** *** *** ** ** * *** ** * * **** * **** * ** **** * * 1 1\n");
*** **** ** * ** ** * * ****** * ** * * ***** * **** * ** * ******* * * * **** * *** ** * * * 2 1");}
* * * *** * * ** * *** * (n==4){printf(" * ****** **** * **
* * * ******* * * * ** ** * ** ** * ** **** * * ** * ** * * ******* ***** * * * ******* *  1 1\n");
* ** * *** * ***** ** ** * ** ** * ***** * * * * * * * * *** * * * * * **** 1 2 1\n");
* * **** * * ** ***** * * * ****** * ** ** * **** * ** ******* * * ** * * * 3 3 1");}
* * ** ***** ***** ** * * (n==5){printf(" * * *** *** ********
**** ** *** *** * ** * **** * ******* * * * ** * **** * ****** *** * ** * * * * * *   1 1\n");
**** * * * * * ** **** *** * * *** ****** ***** ****** ** *** * **** * ** ***  1 2 1\n");
* * ** ** * ***** ** ** **** ** ** * ** ** ****** *** **** ** 1 3 3 1\n");
* * **** ***** * * * ** **** * * ** ** * * * * ** * *** * ** * * * 4 6 4 1");}

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

int main()
{
    int x;
* * * **** * * * **** **** *** ** ** ** * *
    int a[x][x],i,j;
* ** *** **** * * == 0)
* * * * * * ** ** *** * * ** ** **** * *** *
* * ** * * * * *** ** *** ** = 0 ; i < x ; i++)
    {
* ** ** ** * * * * ** ** *** * *** * = 0 ; j < x-1-i ; j++)
**** * *** * ** **** ****** ** * ** ** * * *** ***** *** * **** **** * ** * ");
* ** ** * *** ** * * ****** * ** * * ** * = 0 ; j <= i ; j++)
* ** * * * ***** * ** *** * *** * * * * ****
****** * * * ** *********** ** * **** * * * * ****** *** * ** ** * == 0 || j == i)
** * ** * * ** **** * ***** * * *** * * ******* * *** *** * * *** * ****** *** * ** ** = 1;
** **** * ** ** ***** ** * **** * ** *** * ** *** ** ** * * * **
** ** ****** * * * * * * ** * *** * * *** * * * * * * **** * * * * * * * ** **** * ** * * = a[i-1][j-1]+a[i-1][j];
* ** * ** * ** *** *** * *** **** ** * * **** * *** * * * ****** != 0)
** ** * * ** ** * ** ** *** * * ** * * * **** * ****** * ** ** * * **** **** ** ****** * %d",a[i][j]);
** * ** ** *** * ** ** ** * * * ** * ** * ** * ** * **
** ** ** **** * * ** * * ** *** * * * ** * ***** * * * ********* **** ** * * ****** * ** *
* * ** **** ** ** ** * ** **** * *** * * * * ***
* * ** * * ***** ****** * * * * * ** ***** ****** != x-1)
* **** *** **** *** ******* * ** * ** ** **** * *** ** *** * ** ** *** * * *
    }


*** ***** *********** * 0;
}
answered by (-255 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Wrong output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include * *** * ** *
int main (){
int n[20],i,j,k,l;
* * ** number :");
*** ** *** * * * * *** *
***** ** *** * *
printf(" ");
* ** *** *** **
*** * *
{
*** ** **** * * ** * * * (j=1;j<n;j--)
**** * * * * **** ** **** *
* * * * * * **** *** *** * * * ");
** *** **** * * * ** *
** * ** ** ** * * *
* * * ** ** *
* ** * * *** ** ***** * **** * ****** *
**** *** * * *** * ****
** * ** * **** ** * ** *** * ***** *
** **** ** * * * * ** ** **** * **
* * * **** ** * * **
* ** * * * * * **** %d",n[i]);

** ** ** * ****
}
** **** * * ***** * ***
return 0;
}
answered by (16 points)
0 0
prog.c: In function 'main':
prog.c:5:9: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int (*)[20]' [-Wformat=]
 scanf("%d",&n);
         ^
prog.c:6:10: warning: comparison between pointer and integer
 for(j=0;j<n;j++)
          ^
prog.c:9:10: warning: comparison between pointer and integer
 for(i=1;i<n;i++)
          ^
prog.c:11:15: warning: comparison between pointer and integer
     for (j=1;j<n;j--)
               ^
prog.c:17:15: warning: comparison between pointer and integer
     for (k=1;k<(n-j);k++)
               ^
prog.c:20:14: warning: comparison between pointer and integer
     for(l=1;l<n;l++)
              ^
0 like 0 dislike
Hidden content!
#include<stdio.h>
#include<string.h>

int main()
{
    int a[100][100],n,i,j;
* ** *** * *** * * ** * *** ** * ** ** ** ** ** *
    if(n==0) printf("0");
    for(i=1;i<=n;i++)
        {
**** * * * * ** * * ** *** * *** * ** ** ** * ** * * * *****
* * ** ** ** ** * *** * ** ** ** ***** * ** * ** * *** * * * ** ** *
** ** * ***** ** * * * ***** *** ** *** * * **** ** ** * * * ** **** **** * * ** * *** *
* * ******** * *** * * *** *** ** ****** ** * * * * ** *** *** ** * * * ****** *** * ** * * **** * ***** * * ** ** * ");
* ** * * * * *** **** * *** ** * * * *** *** * *** *** *** **** * ** ** *** *
** * *** * *** ********* * ** ** ** ****** **** ** * * ** * ** * * * ** * **

** * **** * * ******** ** * ** ******* ** * *** * * *** * ****** ** * *** ** *** * * ** **
* * * * * *** ****** * *** ** * * ** *** * * * * * ***** * * ** *** ** * * * * ** * *** *
***** * ** ** *** * ** ** * * *** ** ** * * * * * * ** ** * * * * * ** * **** * ** * * **** **** *****
*** * * * * ****** * * *** * * ** **** *** *** * **** * *** * * *** ****** * ****** * * * * * * ***** * * * *** * %d",a[i][j]);
* * * * * * ** ** ** * * ** **** * * *** * *** ** * * * * * ** * ** * * * ******* ** ***
* * * *** ** ******** * **** * * ** ** * * * * ** ** * *** * * * * *** * ** ** **
* * ** ** * ** * * * * ** ** * * ** * ******* * * *** != n) printf("\n");
        }


}
answered by (-301 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main()
{
    int row;
** ** **** *** * * ** ** ** ** * **
    int pascal[row][row];
    if(row==0)
* ***** ** * ******* * ** * * * * * *** * **** * * *** ****
    else
    {
* * ***** * ******* * *** * *** ** ** i;
**** *** * * ** **** *** ** * * *** * * ****
        {
** ***** * ** * ** * * * *** * *** * ***** * ** * *** **** * * *
*** * ** ******** ** * **** **** * ** **** ** * ** *** *** ****** ** ** **
        }
** * ** * ** **** ***** ** ** *** ** **** ** * j;
** * * *** ** * ** * ** * ***** ** * **** *** * ** *****
        {
** * * * * *** ** **** * ** ** ** * * *** *** * * *** * * * ** * ** * **
* ** * ** ** *** * * **** ** *** ******** ** * *
** ** * * ** * ** * * * * * ** ***** ** **** ** ** * **** *** ** * * * **** * *** * ** *** ** * * * * **
* * * * * ** * *** *** *** ** ** * * * * *** ***** * ***** * *
        }

*** * * * ** * * * *** * ** * ** **** ** * * * * *
        {
*** ** *** ** ** ** * * * ** **** * * * ****** * * ** * ** * * ***** **
*** ** ** ****** * ** * *** * * * ** ** *** * * *** *** ** *** ** * *** *
** * * ** * *** * * **** *** * * ** * * * ** **** ** * * *** * ** * ******* * ** * * **** ");
** * ** *** ** * * * ** ***** * ** *** ****** * ** * *
** * * ** ** * * * * * ***** *** *** * * ******* *** * * ****** *
** ** * ***** * * * *** ****** **** ** * * * *** ** * * ******** * * * * **
*** ** **** ***** ******** * ****** * ** ** * * * *** *** * *** * * * *
* * ** * * * ** * *** ***** * *** * * * ** ** ** * * ***** ** ** * * *** * **** * ** **** *** * %d",pascal[i][j]);
** * * ** ** * * * ****** * * ***** * *** * * ** ** ****
* *** ** ** * * * * * **** * * *** * * *** * *** *** ** ** **


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

** ** * *** *** **** * * * ** * ** *** *** **** ** * * * **** * * ***
*** *** * ** * * * * ** ** ** * * * * ** * **** * * ** ** **** *
*** ** ***** ******** **** ** * ** *** * ** * * * * * *** ***** * ** * *** * * ** ** * *** ** * * * ");
* ** ******* * *** *** ** * *** * * *** * * ****** * ** *
* * * * * *** * * * *** ** ** * * * * * * **** *** * * *** ** * **** *
* * ** ** *** ** **** *** * *** * **** **** *** ** ** **** ** *** * * ** *** * **
****** * *** *** ** ** **** **** * ** * ** ** ** * * ** * **
***** **** * * * ** * * ** *** *** *** * * ******** **** * * * ** * * * ** ***** ** ** * %d",pascal[i][j]);
** * * * * * ***** **** * * *** ** * *** ********* **** * ** *






    }





    return 0;
}
answered by (-196 points)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
0 like 0 dislike
Hidden content!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
int a[999][999];
int num,i,j;

scanf("%d", &num);
if (num==0){
 printf ("0");}
for (i=1;i<=num;i++)
{
*** * **** ** ***
***** * * * * * ** * ** **** * *
* *** **** * ** * * ***
** *** * *** *** * *** ");
* * * *** * * **
** ** * *** * * *** ** * ***** * * ** ** * * * * ** * * **
**** *** ** * ** ****** *** *** * * ** ***** * * * *
* ** *** * * * ** *** * * * * * ** * **
** * * ** ** ** * **** * * ** * ** ******* ** * * *** * * * * * **** ** *** ***
**** ** * ** * * * ** * * * * * ** ** * **** ******* ** ** *** %d", a[i][j]);
* * *** *** ** * ***** ** * **** * * * **
* * ** ***** ****** * *** * ***** ** * * ***** ** ** * ** * ** ** * * * (i!= num)
* * * ** * *** *** *** *** * ** * * * **** ** ** * *** *** * *** * ** * *** * * **** * *****
** ** * * * ** * ** * ** * *** *
** * *** * *** * ** * ** * * * ****** 0;
*** *** * ***** **
answered by (323 points)
edited by
0 0
prog.c: In function 'main':
prog.c:17:5: error: expected expression at end of input
     for (i=0;i<10;i++)
     ^~~
prog.c:17:5: error: expected declaration or statement at end of input
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Correct output
Case 3: Correct output
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.131.4
©2016-2024

Related questions

1 like 0 dislike
37 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42302 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 1.8k views
1 like 0 dislike
32 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42300 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 2.1k views
1 like 0 dislike
37 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42299 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 2.2k views
2 like 0 dislike
30 answers
[Exam] asked Jan 16, 2018 in Final Exam
ID: 42298 - Available when: 2018-01-17 14:00 - Due to: Unlimited
| 1.5k views
0 like 0 dislike
6 answers
[Exam] asked Jan 19, 2018 in Final Exam
ID: 43462 - Available when: 2018-01-20 09:00 - Due to: Unlimited
| 379 views
12,783 questions
183,443 answers
172,219 comments
4,824 users