Example Code

Generate a 1-D Array of any Length Using Pascal's Triangle

Code and Documents

Attachment

Overview

This example code will use the principles of Pascal's triangle to create an array of numbers. The user specifies the number of elements in the array and the values are generated to match the appropriate row in Pascal's triangle.

Description

Pascal's triangle is an important mathematical concept that has applications in numerous fields. It has many interesting properties. Please refer to the following external website for more information about this concept: http://www.mathsisfun.com/pascals-triangle.html

Steps to Implement or Execute Code

  1. Enter the number of rows that you would like to generate
  2. Run the code
  3. Notice that the array output follows the pattern of Pascal's triangle.

Requirements

Software

LabVIEW 2014

Hardware

None

Additional Images or Video

Pascals Triangle.png


Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors