100% found this document useful (1 vote)
30 views

Sub Dim As Integer For To Next For To Step Next For To Step Next End Sub End

The document contains code snippets demonstrating the use of different loop structures in Visual Basic, including FOR loops iterating from 1 to 20, FOR loops stepping by 4, FOR loops counting down, and a WHILE loop counting up from 0 to 10. It also includes code to print multiplication tables and find all divisors of a user-input number.
Copyright
© Attribution Non-Commercial (BY-NC)
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
100% found this document useful (1 vote)
30 views

Sub Dim As Integer For To Next For To Step Next For To Step Next End Sub End

The document contains code snippets demonstrating the use of different loop structures in Visual Basic, including FOR loops iterating from 1 to 20, FOR loops stepping by 4, FOR loops counting down, and a WHILE loop counting up from 0 to 10. It also includes code to print multiplication tables and find all divisors of a user-input number.
Copyright
© Attribution Non-Commercial (BY-NC)
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
You are on page 1/ 3

FOR

Module Module1 Sub Main() Dim i As Integer For i = 1 To 20 Console.WriteLine(i) Next Console.WriteLine("segundo tipo de for") For i = 1 To 20 Step 4 Console.WriteLine(i) Next Console.WriteLine("tercer tipo de for ") For i = 20 To 1 Step -1 Console.WriteLine(i) Next Console.ReadLine() End Sub End Module

1*1=1 1*2=2 Tabla de multiplicar


Sub Main() Dim i As Integer Dim n As Integer For i = 1 To 12 Console.WriteLine("la tabla de multiplicar del numero :" & i) For n = 12 To 1 Step -1 Console.WriteLine(i & " * " & n & "=" & (i * n)) Next Next Console.ReadLine()

Tabla de multiplicar
Module Module2 Sub Main() Dim i As Integer Dim n As Integer For i = 1 To 12 Console.WriteLine("la tabla de multiplicar del numero :" & i) For n = 1 To 12 Console.WriteLine(i & " * " & n & "=" & (i * n)) Next Next Console.ReadLine() End Sub End Module

WHILE
Module while9 Sub Main() Dim i As Integer While 10 > i Console.WriteLine(i) i=i+1 End While Console.ReadLine() End Sub

End Module

DIVISORES DE UN NUMERO CUALKIERA

Module divisores_de_un_numero Sub Main() Dim i, n As Integer Console.Write("ingresar un numero :") n = CInt(Console.ReadLine()) i = 1 While 1 <= n If (n Mod i = 0) Then Console.WriteLine(i) End If i = i + 1 End While Console.ReadLine() End Sub

End Module

You might also like