Skip to content

Latest commit

 

History

History

PasTri

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

PasTri

Introduction

Pascal’s triangle is a triangular array composed of the binomial coefficients.

Write a function to generate a Pascal’s triangle.

Your function should like this:

function PasTri(n)

The input n means that you should output n lines of Pascal’s triangle.

Your output should be in a text file and in the given format.

For instance in the case n=5,

The output should be like this in a .txt file:

              1   
           1     1   
        1     2     1   
     1     3     3     1   
  1     4     6     4     1   

Work cited

Question 3, Lab2, VG101, Jigang Wu, FA2015 & FA2016 Ex.2, Lab2, VG101, Manual, FA2016