in visual basics. (1) The following program asks the user for two numbers and then outputs the total. Create this program in the console. Dim vNum As Integer Dim vTot As Integer For vNum = 0 To 1 Console.WriteLine(“Enter a number?”) vTot= vTot+ Val(Console.Readline()) Next Console.WriteLine(“The total is “ & vTot) (2) Use the For next loop to make sums. Create a console application and use the following code. Dim vNum As Integer Dim vTot As Integer = 0 For vNum = 0 To 10 vTot = vTot + vNum Next Console.WriteLine(vTot) (3) Use the following code to make a table in the console. Call the application Simple Table Dim vCol As Integer Dim vRow as Integer Dim vLine As String For vCol =0 To 5 vLine = “” For vRow =0 To 4 vLine = vLine & “x “ Next Console.WriteLine(vLine) Next (4) Modify the above code to print out a consecutive series of numbers. Eg 1 2 3 4 5 6 7 8 (5) In the space below using a For next loop write a procedure which prints to the console the numbers 0 1 2 3
in visual basics.
(1) The following program asks the user for two numbers and then outputs the total. Create this program in the console.
Dim vNum As Integer
Dim vTot As Integer
For vNum = 0 To 1
Console.WriteLine(“Enter a number?”)
vTot= vTot+ Val(Console.Readline())
Next
Console.WriteLine(“The total is “ & vTot)
(2) Use the For next loop to make sums. Create a console application and use the following code.
Dim vNum As Integer
Dim vTot As Integer = 0
For vNum = 0 To 10
vTot = vTot + vNum
Next
Console.WriteLine(vTot)
(3) Use the following code to make a table in the console. Call the application Simple Table
Dim vCol As Integer
Dim vRow as Integer
Dim vLine As String
For vCol =0 To 5
vLine = “”
For vRow =0 To 4
vLine = vLine & “x “
Next
Console.WriteLine(vLine)
Next
(4) Modify the above code to print out a consecutive series of numbers. Eg
1 2 3 4
5 6 7 8
(5) In the space below using a For next loop write a procedure which prints to the console the numbers 0 1 2 3
Step by step
Solved in 6 steps with 5 images