0% found this document useful (0 votes)
61 views11 pages

Visual Basic Pattern Programs

The document contains 9 programs that generate different patterns using loops and conditionals in Visual Basic. Each program prints a numeric or asterisk pattern of increasing complexity, with Program 1 printing a simple ascending asterisk pattern and Program 9 printing a descending numeric pattern with numbers aligned vertically. The programs demonstrate basic pattern generation using loops and conditionals.

Uploaded by

Abhinav arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views11 pages

Visual Basic Pattern Programs

The document contains 9 programs that generate different patterns using loops and conditionals in Visual Basic. Each program prints a numeric or asterisk pattern of increasing complexity, with Program 1 printing a simple ascending asterisk pattern and Program 9 printing a descending numeric pattern with numbers aligned vertically. The programs demonstrate basic pattern generation using loops and conditionals.

Uploaded by

Abhinav arora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Practical No-01

Pattern:
1. Program No-1
Module Module1

Sub Main()

Dim i, j, n, row As Integer

[Link](" Program 1 of Pattern ")

[Link](" ")

row = 5

For i = 1 To row

For n = i To row - 1

[Link](" ")

Next

For j = 1 To i

[Link]("*")

[Link](" ")

Next

[Link]()

Next

[Link]()

End Sub

End Module
2. Program No-2

Module Module1

Sub Main()

Dim i, j, row, k As Integer

[Link]("Program 2 of Pattern")

[Link](" ")

row = 3

For i = 1 To row

For j = 1 To i

k=k+1

[Link](k & " ")

Next

[Link]()

Next

[Link]()

End Sub

End Module
3. Program No-3
Module Module1

Sub Main()

Dim i, j, n, row, k As Integer

[Link]("Program 3 of Pattern")

row = 3

For i = 1 To row

For n = i To row - 1

[Link](" ")

Next

For j = 1 To i

k=k+1

[Link](k)

[Link](" ")

Next

[Link]()

Next

[Link]()
End Sub

End Module

4. Program No-4

Module Module1

Sub Main()

Dim i, j, row As Integer

[Link]("Program 4 of Pattern")

row = 3

For i = 1 To row

For j = 1 To i

[Link]("*")

Next

[Link]()

Next

[Link]()

End Sub

End Module
5. Program No-5

Module Module1

Sub Main()

Dim i, j, row As Integer

[Link]("Program 5 of Pattern")

row = 3

For i = 1 To row

For j = i To row

[Link]("* ")

Next

[Link]()

Next

[Link]()

End Sub

End Module
6. Program No-6

Module Module1

Sub Main()

Dim i, j, n, row, count, num As Integer

[Link]("Program 6 of Pattern")

count = 0

row = 3

For i = 1 To row

For n = i To row - 1

[Link](" ")

Next

For j = 1 To i

num = num + 1

[Link](num)

[Link](" ")

Next

[Link]()

count = count + 1

Next
For i = 2 To count

For n = 2 To i

[Link](" ")

Next

For j = -count To -i

num = num + 1

[Link](num)

[Link](" ")

Next

[Link]()

Next

[Link]()

End Sub

End Module

7. Program No-7
Module Module1

Sub Main()

[Link]("Program 7 of Pattern")

Dim i, j, n, row, count As Integer

count = 0

row = 3

For i = 1 To row

For n = i To row - 1

[Link](" ")

Next

For j = 1 To i

[Link]("*")

[Link](" ")

Next

[Link]()

count = count + 1

Next

For i = 2 To count

For n = 2 To i

[Link](" ")

Next

For j = -count To -i

[Link]("*")

[Link](" ")

Next

[Link]()

Next

[Link]()
End Sub

End Module

8. Program No-8

Module Module1

Sub Main()

Dim i, j, k, sp As Integer

[Link]("Program 8 of Pattern")

sp = 3

For i = 1 To sp

For k = i To sp - 1

[Link](" ")

Next

For j = 1 To i

[Link]("*")

Next

[Link]()

Next

[Link]()
End Sub

End Module

9. Program No-9

Module Module1

Sub Main()

Dim i, j, k, sp, num As Integer

[Link]("Program 9 of Pattern")

sp = 3

num = 1

For i = 1 To sp

For k = i To sp - 1

[Link](" ")

Next

For j = 1 To i

[Link](num)

num = num - 1

Next
For num = i To i

num = i

Next

[Link]()

Next

[Link]()

End Sub

End Module

You might also like