In: Computer Science
Write Visual Basic program that seperates all natural numbers up to 863 value with a comma side by side and show on the screen
Please write readable.Thankss
'VB console visual basic program that display the
comma-separated
'values from 1 to 863 on the console screen.
'Create a VB console project and name of your choice and say , "PrintNumbers" and then
'write below code in the Module1
'Module1.vb
Module Module1
Sub Main()
'Declare start as integer variable
Dim start As Integer
'Start from 1 to 863
For start = 1 To 863
If start = 863 Then
'Set no comma for last element
' where 0 represents the first argument value
'-3 is to left justification with width of 3 space
Console.Write("{0,-3}", start)
Else
'else case to set comma for numbers
Console.Write("{0,-3} , ", start)
End If 'end of if else case
Next 'end of for loop
'Read a key and close the window
Console.Read()
End Sub
End Module
---------------------------------------------------Screen
shot of
code---------------------------------------------------
----------------------------------------------------Sample Output#----------------------------------------------------------------