Home > Software engineering >  Ask for help
Ask for help

Time:11-03

VB use two-dimensional array output of Yang hui triangle 35
1
1 1
1 2 1
3 3 1
1 4 6 4 1
5 10 10 1
1 6 15 20 15 1
1 July 21 35 35 21 July 1
1 August 28, 56, 70, 56, 28 81
36 84 126 126 84 36 9th September 1

CodePudding user response:

 
Dim n As an Integer, I, As an Integer, j As Integer
X=InputBox (" please enter n ")
N=Val (x)
ReDim a (n + 1, n + 1) As an Integer
For I=1 To n + 1
A (I, 1)=1: a (I, I)=1: Next I
For I=3 To the n + 1
For j=2 To 1
I -A (I, j)=a (I - 1, j - 1) + a (I - 1, j)
Next j, I
For I=1 To n + 1
The Print Tab (30-2 * I);
For j=1 To I
The Print Space (4 - Len (Trim (Str (a (I, j))))); Trim (Str (a (I, j)));
Next j
Print the
Next I

For your reference!

CodePudding user response:

You this is the VB homework
I can fix it for you, look at this thread: http://bbs.csdn.net/topics/390483573

CodePudding user response:

Write about myself, at least you can learn something!
  • Related