For i = 1 To n fact = fact * i Next i
The next number is the sum of the previous two numbers. We need three variables: a , b , and c .
(Note: Ensure TextBox2 has the property Multiline = True to display the series.) Moving forward, BCA students must understand how to handle data collections. Program 5: Sorting an Array (Bubble Sort) Objective: Input 5 numbers and sort them in ascending order. vb net lab programs for bca students
Factorial of 5 is $5 \times 4 \times 3 \times 2 \times 1$. We use a For loop iterating backwards or forwards to multiply the numbers.
Use the Modulus operator ( Mod ). If a number divided by 2 leaves a remainder of 0, it is Even. For i = 1 To n fact =
Public Class Form1 ' Variable declaration Dim num1, num2, result As Double Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click num1 = Val(TextBox1.Text) num2 = Val(TextBox2.Text) result = num1 + num2 Label1.Text = "Result: " & result End Sub
Private Sub btnSub_Click(sender As Object, e As EventArgs) Handles btnSub.Click num1 = Val(TextBox1.Text) num2 = Val(TextBox2.Text) result = num1 - num2 Label1.Text = "Result: " & result End Sub Program 5: Sorting an Array (Bubble Sort) Objective:
We need two input fields (TextBoxes) and operation buttons. The Val() function is used to convert text input into numbers.