Example of For loop in Vb.Net
Module Module1
Dim n, a, b, c, i As Integer
Sub Main()
Console.WriteLine("Enter the number")
n = Console.ReadLine()
a = 0
b = 1
For i = 0 To n
c = a + b
Console.WriteLine(c)
a = b
b = c
Next
Console.ReadLine()
End Sub
End Module
Module Module1
Dim n, a, b, c, i As Integer
Sub Main()
Console.WriteLine("Enter the number")
n = Console.ReadLine()
a = 0
b = 1
For i = 0 To n
c = a + b
Console.WriteLine(c)
a = b
b = c
Next
Console.ReadLine()
End Sub
End Module
0 comments: