Q12 Write a VB.Net console program to print the series like 1 2 3 4 5 up to n terms.

The code is as follows:

Module Module1
Dim n As Integer
Dim i As Integer

Sub Main()
System.Console.Write("Enter the value of n=")
n = System.Console.ReadLine()
For i = 1 To n
System.Console.Write(" " & i)

End Sub

End Module

In this program we have declared n,I variables . here we have used the Console.Write function to show message and Console.ReadLine function to get input and assign it into the variable n. after that we have used the for loop and have a condition i=1 To n means loop will be continued to the nth value when condition will be false then loop will terminate. The output is as follows: