(AN AUTONOMOUS UNIT OF RANCHI UNIVERSITY FROM 2009)
- Prakash Kumar, Dept. of CA
-Raju Manjhi Dept. of CA
__________________________________________________________________________________
Console program structure:
1.
Module Module1
Sub Main()
Console.Write(" Welcome to Vb.Net")
Console.Read()
End Sub
End Module
If ....Then......Else.....End If
1. To add two numbers
Module Module1
Sub Main()
Dim a, b, c As Integer
Console.Write("Enter first number:")
a = Console.ReadLine
Console.Write("Enter Second number:")
b = Console.ReadLine
c = a + b
Console.Write("Addition=:" & c)
Console.Read()
End Sub
End Module
2. Find greater between two numbers
Module Module1
Sub Main()
Dim a, b As Integer
Console.Write("Enter first number:")
a = Console.ReadLine
Console.Write("Enter Second number:")
b = Console.ReadLine
If a > b Then
Console.Write("A is greater")
Else
Console.Write("B is greater")
End If
Console.Read()
End Sub
End Module
3. Check whether the year is leap or not
Module Module1
Sub Main()
Dim y As Integer
Console.Write("Enter the year:")
y = Console.ReadLine
If (y Mod 4 = 0 And y Mod 100 <> 0 Or y Mod 400 = 0) Then
Console.Write("Year is Leap Year")
Else
Console.Write("Year is Not Leap Year")
End If
Console.Read()
End Sub
End Module
Note:
Practice some more programs using if statement
Follow the link : https://youtu.be/Yi5ubKk6mOI
Operators:
Arithmetic Operators
Practice Video using If statement
Console program structure:
1.
Module Module1
Sub Main()
Console.Write(" Welcome to Vb.Net")
Console.Read()
End Sub
End Module
If ....Then......Else.....End If
1. To add two numbers
Module Module1
Sub Main()
Dim a, b, c As Integer
Console.Write("Enter first number:")
a = Console.ReadLine
Console.Write("Enter Second number:")
b = Console.ReadLine
c = a + b
Console.Write("Addition=:" & c)
Console.Read()
End Sub
End Module
2. Find greater between two numbers
Module Module1
Sub Main()
Dim a, b As Integer
Console.Write("Enter first number:")
a = Console.ReadLine
Console.Write("Enter Second number:")
b = Console.ReadLine
If a > b Then
Console.Write("A is greater")
Else
Console.Write("B is greater")
End If
Console.Read()
End Sub
End Module
3. Check whether the year is leap or not
Module Module1
Sub Main()
Dim y As Integer
Console.Write("Enter the year:")
y = Console.ReadLine
If (y Mod 4 = 0 And y Mod 100 <> 0 Or y Mod 400 = 0) Then
Console.Write("Year is Leap Year")
Else
Console.Write("Year is Not Leap Year")
End If
Console.Read()
End Sub
End Module
Note:
Practice some more programs using if statement
Follow the link : https://youtu.be/Yi5ubKk6mOI
Operators:
Arithmetic Operators
Comparison Operators
Logical Operators
No comments:
Post a Comment