Typical C language questions: Yang Hui triangle and Yang Hui triangle
Typical C language questions c34 Yang Hui triangle
/* [Procedure 34] Yang Hui triangle * Subject: print Yang Hui triangle first 10 rows 1 1 1 1 2 1 1 3 1 1 1 4 6 4 1 1 1 5 10 5 1 1 6 15 15 15 6 1 1 7 21 35 21 7 1 1 8 28 56 70 56 28 8 1 1 9 36 84 126 126 84 36 9 1 * program analysis: 1) The number of endpoints is 1.2.) Each number is equal to the sum of the two above. 3) The numbers in each row are symmetric between the left and right, and gradually increase from 1. 4) There are n numbers in the nth row. 5) The number in line n is 2n-1. 6) Each number is equal to the sum of the left and right numbers in the previous row. 7) a number equal to (flaot) (number of rows-(number of columns-1)/(number of columns-1) * (number of the previous column) # include
# Define N 10int main (int argc, char * argv []) {int I, j, k, yh; float num; for (I = 0; I