Aaasss
Aaasss
Ans:
Dim op As String
TextBox1.Text += "1"
End Sub
TextBox1.Text += "2"
End Sub
TextBox1.Text += "3"
End Sub
TextBox1.Text += "4"
End Sub
TextBox1.Text += "5"
End Sub
TextBox1.Text += "6"
End Sub
TextBox1.Text += "7"
End Sub
TextBox1.Text += "8"
End Sub
TextBox1.Text += "9"
End Sub
TextBox1.Text += "0"
End Sub
TextBox1.Text += "."
End Sub
num1 = TextBox1.Text
TextBox1.Text = ""
op = "+"
TextBox2.Text = "+"
End Sub
num1 = TextBox1.Text
TextBox1.Text = ""
op = "-"
TextBox2.Text = "-"
End Sub
num1 = TextBox1.Text
TextBox1.Text = ""
op = "*"
TextBox2.Text = "*"
End Sub
num1 = TextBox1.Text
TextBox1.Text = ""
op = "/"
TextBox2.Text = "/"
End Sub
num2 = TextBox1.Text
If op = "+" Then
End If
End Sub
Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Sub
End Class
7. Write a program using sub procedure to display employee details.
Module employee
Dim firstname As String
Dim lastname As String
Dim id As Integer
Dim contact As Double
Dim age As Integer
Sub getdetails()
Console.WriteLine("Enter first name")
firstname = Console.ReadLine
Console.WriteLine("Enter last name")
lastname = Console.ReadLine
Console.WriteLine("Enter ID")
id = Console.ReadLine
Console.WriteLine("Enter Contact")
contact = Console.ReadLine
Console.WriteLine("Enter age")
age = Console.ReadLine
End Sub
Sub displaydata()
Console.WriteLine("Firstname:{0}", firstname)
Console.WriteLine("Lastname:{0}", lastname)
Console.WriteLine("ID:{0}", id)
Console.WriteLine("Contact:{0}", contact)
Console.WriteLine("Age:{0}", age)
End Sub
Sub main()
getdetails()
displaydata()
End Sub
8.Write a program to input N numbers into an array and sort them in descending order and display.
Imports System
Module Program
Sub Main()
Console.Write("Enter the number of elements: ")
Dim n As Integer = Convert.ToInt32(Console.ReadLine())
Dim arr(n - 1) As Integer
For i As Integer = 0 To n - 1
Console.Write("Enter element {0}: ", i + 1)
arr(i) = Convert.ToInt32(Console.ReadLine())
Next
For i As Integer = 0 To n - 2
For j As Integer = 0 To n - i - 2
If arr(j) < arr(j + 1) Then
' Swap the elements
Dim temp As Integer = arr(j)
arr(j) = arr(j + 1)
arr(j + 1) = temp
End If
Next
Next
Console.WriteLine("Sorted array in descending order:")
For i As Integer = 0 To n - 1
Console.Write(arr(i) & " ")
Next
Console.ReadLine()
End Sub
End Module