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

31 Answers

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

int main()
{
* ** * * ** * ** ** **** **** ** ** **
** * ** * ** * *** 0;
}
answered by (-108 points)
0 0
Case 0: Wrong output
Case 1: Wrong output
Case 2: Wrong output
Case 3: Wrong output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.70.126.236
©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
| 2k 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.3k 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.4k 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.7k 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
| 386 views
12,783 questions
183,443 answers
172,219 comments
4,824 users