VB.NET Questions Answers- VB.NET loops (PartII)


VB.NET loops (PartII)

1. Change the following VB.NET code from using a while loop to for loop:
x=1
while(x<10)
  Console.Write("{0}",x &vbTab)
  x+=1
End While
Check answer 2. What would be the output from the following VB.NET code segment?
x=10
While(x>5)
  Console.WriteLine("{0}",x)
  x-=1
End While
Check answer 3. Change the following VB.NET code from a for loop to a while loop:
for i=1 to 49
  Console.Write("{0}",i & vbTab)
Next Check answer 4. What would be printed from the following VB.NET code segment?
For i=20 to 1 Step -2
  Console.WriteLine("{0}",i)
Next Check answer 5. What would be printed from the following VB.NET code segment?
Dim x, y As Integer
For x = 1 To 5
   For y = 1 To x
        Console.Write("{0}", x & vbTab)

        Next
    Console.WriteLine()
Next

Check answer 6. Change the following VB.NET code from a do while loop to a while loop:
x=0
Do
  Console.Write("{0}",x & vbTab)
  x+=1
 Loop While(x<10)
Check answer


Comments




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.