Beruflich Dokumente
Kultur Dokumente
Hitesh
02117702014
OUTPUT:-
CODE:Module Module1
Sub Main()
Dim a As Integer
Console.WriteLine("Enter a number")
a = Console.ReadLine()
If a Mod 2 = 0 Then
If a Mod 3 = 0 Then
If a Mod 5 = 0 Then
Console.WriteLine("Number Is Divisible By All")
Else
Console.WriteLine("Number Is Divisible By 2 And 3")
End If
ElseIf a Mod 5 = 0 Then
Console.WriteLine("Number Is Divisible By 2 And 5")
Else
Console.WriteLine("Number Is Divisible By 2 ")
End If
ElseIf a Mod 3 = 0 Then
If a Mod 5 = 0 Then
Console.WriteLine("Number Is Divisible By 3 And 5")
Else
Console.WriteLine("Number Is Divisible By 3 ")
End If
ElseIf a Mod 5 = 0 Then
Console.WriteLine("Only By 5")
Else
Console.WriteLine("Not By Any")
End If
End Sub
End Module
OUTPUT:-
Q7. A) WAP in VB.NET to show the use of switch case by windows application?
Hitesh
02117702014
Q7. B) WAP in VB.NET to show the use of switch case by console application?
CODE:Module Module1
Hitesh
02117702014
Sub Main()
Dim grade As String
Console.WriteLine("Enter your grade")
grade = Console.ReadLine()
Select Case grade
Case "A"
Console.WriteLine("High Distinction")
Case "A-"
Console.WriteLine("Distinction")
Case "B"
Console.WriteLine("Credit")
Case "C"
Console.WriteLine("Pass")
Case Else
Console.WriteLine("Fail")
End Select
End Sub
End Module
OUTPUT:-
CODE:Module Module1
Sub Main()
Dim a, i, j, table As Integer
Console.WriteLine("Enter an number to print its Table")
a = Console.ReadLine()
Console.WriteLine("Enter upto which value you want print the Table")
i = Console.ReadLine()
For j = 1 To i Step 1
table = a * j
Console.WriteLine("{0} * {1} = {2}", a, j, table)
Next
End Sub
End Module
OUTPUT:-
Q9. ) WAP in VB.NET to find sum of rows in 2-d array by console application?
Hitesh
02117702014
CODE:Module Module1
Sub Main()
Dim arr(2, 3), sum(2) As Integer
Console.WriteLine("enter the numbers")
For a As Integer = 0 To 2 Step 1
For b As Integer = 0 To 3 Step 1
arr(a, b) = Console.ReadLine()
sum(a) += arr(a, b)
Next
Next
For a As Integer = 0 To 2
For b As Integer = 0 To 3
Console.Write(arr(a, b) & vbTab)
Next
Console.Write(sum(a))
Console.WriteLine()
Next
End Sub
End Module
OUTPUT:-
Q10. )WAP IN VB.NET to take input for a jagged array from user and print It by
console application?
CODE:Hitesh
02117702014
Module Module1
Sub Main()
Dim column, i, j As Integer
Dim a()() As Integer = New Integer(2)() {}
Console.WriteLine("enter the no of columns of jagged array")
For i = 0 To 2
Console.WriteLine("enter the number of columns for {0} row", i)
column = Console.ReadLine()
column = column - 1
a(i) = New Integer(column) {}
Next
Console.WriteLine("enter the elements of Jagged Array")
For i = 0 To 2
For j = a(i).GetLowerBound(0) To a(i).GetUpperBound(0)
a(i)(j) = Console.ReadLine()
Next
Next
Console.WriteLine("Jagged Array is ")
For i = 0 To 2
For j = a(i).GetLowerBound(0) To a(i).GetUpperBound(0)
Console.Write(a(i)(j))
Console.Write(vbTab)
Next
Console.WriteLine()
Next
End Sub
End Module
OUTPUT:-
Hitesh
02117702014