Import Java. util. *; public class hw5_3 {static int X;/*** @ Param ARGs */public static void main (string [] ARGs) {// todo auto-generated method stub system. out. println ("enter a number"); then SC = new then (system. in); X = SC. nextint (); If (x = 1) {system. out. println ("1");} else if (x = 2) {system. out. println ("1"); system. out. println ("1" + "\ t" + "1");} else if (x <= 0) {system. out. println ("illegal input");} else {int [] [] A = New int [x] []; for (INT I = 0; I <. length; I ++) {A [I] = new int [I + 1] ;}for (int e = 0; e <2; E ++) {for (INT f = 0; F <= E; F ++) {// F <= e! A [E] [f] = 1 ;}}for (INT d = 2; D <. length; D ++) {for (INT c = 1; C <D; C ++) {A [d] [c] = A [D-1] [C-1] + A [D-1] [c];} A [d] [0] = 1; A [d] [d] = 1 ;}for (int o = 0; O <. length; O ++) {for (INT p = 0; P <= O; P ++) {// P <= o !! System. Out. Print (A [O] [p] + "\ t") ;}system. Out. println ();}}}}
Print Yang Hui triangle (right angle) Exercise