Java Code for Printing Pascal Triangle in Format

The following java code prints Pascal Triangle in format.  In Pascal’s triangle, each number is calculated by adding the two numbers directly above (left & right)  in the previous row. The first row in the  triangle starts with 1. The below code accepts the number of rows the Pascal triangle to be printed and  prints the Pascal Triangle in the Format.

Running the above program gives the following output :

pascal triangle

Leave a Reply