You are on page 1of 7

Practical no:-4

Name:-Aditi Pahadi
Branch:-syco
Roll:-40

 Implement the program for finding greatest of three numbers.

Module Module1

Sub Main()
Dim n1, n2, n3 As Integer
Console.WriteLine("enter first number")
n1 = Console.ReadLine()
Console.WriteLine("enter second number")
Console.WriteLine("enter third number")
n3 = Console.ReadLine()
If (n1 > n2 And n1 > n3) Then
Console.WriteLine("n1 is greater")
ElseIf (n2 < n1 And n2 > n3) Then
Console.WriteLine("n2 is greater")
Else
Console.WriteLine("n3 is greater")

End If
Console.ReadLine()

End Sub

OUTPUT:-
Practical no:-5
Name:-Aditi Pahadi
Branch:-syco
Roll:-40

 Implement a program using select case statement to count the number of


vowels in a to z alphabets.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim c As String
c = TextBox1.Text
Select Case c
Case "a"
MsgBox("vowel")
Case "f"
MsgBox("vowel")
Case "i"
MsgBox("vowel")
Case "o"
MsgBox("vowel")
Case "u"
MsgBox("vowel")
Case Else
MsgBox("not vowel")
End Select
End Sub
End Class
OUTPUT:-
Practical no:-6
Name:-Aditi Pahadi
Branch:-syco
Roll:-40

 Write a program using while statement to print even-odd


numbers between 1-50.

Module Module1

Sub Main()
Dim no As Integer
no = 1
While no <= 50
If no Mod 2 = 0 Then
Console.WriteLine("even number:-" & no)
Else
Console.WriteLine("odd number:-" & no)
End If
no = no + 1

End While
Console.ReadLine()

End Sub

End Module
OUTPUT:-
Practical no:-6

Name:-Aditi Pahadi
Branch:-syco
Roll:-40

 Write a program using while statement to print the prime numbers


between 1-100.

Module Module1

Sub Main()
Dim i, j, c As Integer
c=0
i=2
While (i <= 100)
j=2
While (j < i)
If (i Mod j = 0) Then
Exit While
ElseIf (i = j + 1) Then
Console.WriteLine(i)
End If
j=j+1
End While
i=i+1
End While
Console.ReadLine()

End Sub

End Module
OUTPUT:-

You might also like