Program 1:
Module Data_type
Sub Main()
' defining the Data Type to the variables
Dim b As Byte = 1
Dim num As Integer = 5
Dim si As Single
Dim db As Double
Dim get_date As Date
Dim c As Char
Dim str As String
b=1
num = 20
si = 0.12
db = 2131.787
get_date = Today
c = "A"
str = "Hello Friends..."
Console.WriteLine("Welcome ")
Console.WriteLine("Byte is: {0}", b)
Console.WriteLine("Integer number is: {0}", num)
Console.WriteLine("Single data type is: {0}", si)
Console.WriteLine("Double data type is: {0}", db)
Console.WriteLine("Today is: {0}", get_date)
Console.WriteLine("Character is: {0}", b)
Console.WriteLine("String message is: {0}", str)
Console.ReadKey()
End Sub
End Module
Output:
Welcome
Byte is: 1
Integer number is: 20
Single data type is: 0.12
Double data type is: 2131.787
Today is: 31-05-2020 00:00:00
Character is: 1
String message is: Hello Friends...
b. Sub Main()
Dim x As Integer = 15
Dim y As Integer = 3
' Output: x + y = 18
Console.WriteLine("x + y: {0}", x+y)
' Output: x - y = 12
Console.WriteLine("x - y: {0}", x-y)
' Output: x * y = 45
Console.WriteLine("x * y: {0}", x*y)
' Output: x / y = 5
Console.WriteLine("x / y: {0}", x/y)
' Output: x \ y = 5
Console.WriteLine("x \ y: {0}", x\y)
' Output: x MOD y = 0
Console.WriteLine("x MOD y: {0}", x Mod y)
' Output: x ^ y = 3375
Console.WriteLine("x ^ y: {0}", x^y)
End Sub
End Module
Module operators
Sub Main()
Dim x As Integer = 10
Dim y As Integer = 12
'Output: x > y is False
Console.WriteLine("x > y is:{0}", x > y)
'Output: x < y is True
Console.WriteLine("x < y is:{0}", x < y)
'Output: x = y is False
Console.WriteLine("x = y is:{0}", x = y)
'Output: x <> y is True
Console.WriteLine("x <> y is:{0}", x <> y)
'Output: x >= y is False
Console.WriteLine("x >= y is:{0}", x >= y)
'Output: x <= y is True
Console.WriteLine("x <= y is:{0}", x <= y)
End Sub
End Module
Module operators
Sub Main()
Dim x As Boolean = True
Dim y As Boolean = False
'Output: x and y is False
Console.WriteLine("x And yis:{0}", x And y)
'Output: x or y is True
Console.WriteLine("x or y is:{0}", x Or y)
'Output: not x is False
Console.WriteLine("not y is:{0}", Not y)
End Sub
End Module