create Pascal’s Triangle in

In this article we will learn create Pascal’s Triangle in

Create Pascal’s Triangle in

The rows of Pascal’s triangle are conventionally enumerated starting with row n=0 at the top (the 0th row). The entries in each row are numbered from the left beginning with k=0 and are usually staggered relative to the numbers in the adjacent rows.

Code for create Pascal’s Triangle in

Imports System

Module Program
Sub Main(args As String())
Dim rowNumber, blank, i, j As Integer, c As Integer = 1

Console.Write(vbLf & vbLf)
Console.Write(“Input number of rows for Display the Pascal’s triangle: “)
Console.Write(vbLf & vbLf)
rowNumber = Convert.ToInt32(Console.ReadLine())

For i = 0 To rowNumber – 1

For blank = 1 To rowNumber – i
Console.Write(” “)

For j = 0 To i

If j = 0 OrElse i = 0 Then
c = 1
c = c * (i – j + 1) / j
End If

Console.Write(“{0} “, c)



End Sub
End Module

Output for create Pascal’s Triangle in


Leave a Reply

Your email address will not be published.