How to realize Yang Hui Triangle by Java
This article mainly explains "how to realize Yang Hui Triangle by Java". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to realize the Yang Hui Triangle by Java".
Topic output Yang Hui Triangle
1. Program analysis
The solution is carried out by using the characteristics of Yang Hui triangle.
2. Program realization
/ * Topic: Yang Hui Triangle * File Name: Triangle.c * Author: Jack Cui * Created: 9 April 2016 * * * / # include # include / * declare Yang Hui triangulation printing function * / int Triangle (int iHeigh) Void main (void) {int iHeigh,flag = 1; / / height, cycle marker while (flag) {printf ("Please enter the number of layers of Yang Hui Triangle:\ n"); scanf ("% d", & iHeigh); flag = Triangle (iHeigh) Function name: Triangle* parameter description: iHeigh Yang Hui triangle need to print height * description: Yang Hui triangle print * * / int Triangle (int iHeigh) {int iNum,iLine,iColumn / / numeric value, row number 1 represents the first row, column number 1 represents the first column if (iHeigh