Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Module VBModule
Sub Main()
Dim n As Integer = CInt(Console.ReadLine())
Dim ndigits As Integer = 0
While True
Console.ReadLine()
n += n
ndigits += 1
If n = 0 Then Exit While
End While
Console.WriteLine(n / ndigits)
Console.ReadKey()
End Sub
End Module
Module Module1
Sub Main()
Dim time As Integer = CInt(Console.ReadLine)
Dim days As Integer = (time \ 86400)
Dim hours As Integer = (time \ 3600)
Dim minutes As Integer = (time \ 60)
Dim seconds As Integer = (time)
If days > 0 Then
Console.Write(days & " days ")
End If
If hours > 0 Then
Console.Write(days Mod hours & " hours ")
End If
If minutes > 0 Then
Console.Write(hours Mod minutes & " minutes ")
End If
If seconds > 0 Then
Console.Write(minutes Mod seconds & " seconds")
End If
Console.ReadKey()
End Sub
End Module
Module myfunctions
Function FindMax(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
' local variable declaration */
Dim result As Integer
If (num1 > num2) Then
result = num1
Else
result = num2
End If
FindMax = result
End Function
Sub Main()
Dim a As Integer = 100
Dim b As Integer = 200
Dim res As Integer
res = FindMax(a, b)
Console.WriteLine("Max value is : {0}", res)
Console.ReadLine()
End Sub
End Module
Option Strict On
Module Module1
Sub Main()
Dim day As Integer = CInt(Console.ReadLine())
If day >= 7 Then
If day Mod 7 <> 0 Then
Console.WriteLine(day \ 7 & " weeks and " & day Mod 7 & " days")
Else
Console.WriteLine((day \ 7) & " weeks")
End If
ElseIf day < 7 Then
Console.WriteLine(day & " days")
End If
Console.ReadKey()
End Sub
End Module
Option Strict On
Module Module1
Sub Main()
Dim days As Integer = CInt(Console.ReadLine())
Dim weeks As Integer = 0
If days > 7 Then
weeks = CInt(days / 7)
days = days - weeks * 7
End If
If weeks > 0 Then
Console.WriteLine(weeks & " weeks and " & days & " days")
Else
Console.WriteLine(days & " days ")
End If
Console.ReadKey()
End Sub
End Module
Imports System.IO
Module fileProg
Sub Main()
Dim f1 As FileStream = New FileStream("sample.txt", _
FileMode.OpenOrCreate, FileAccess.ReadWrite)
Dim i As Integer
For i = 0 To 20
f1.WriteByte(CByte(i))
Next i
f1.Position = 0
For i = 0 To 20
Console.Write("{0} ", f1.ReadByte())
Next i
f1.Close()
Console.ReadKey()
End Sub
End Module