Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Sub Main() Dim i, j As Integer System.Console.WriteLine("Enter First Integer:") i = Console.ReadLine() System.Console.WriteLine("Enter Second Integer:") j = Console.ReadLine() Console.WriteLine("Result of Addition is:" & (i + j)) Console.WriteLine("Result of Subtraction is:" & (i - j)) Console.WriteLine("Result of Mulptiplication is:" & (i * j)) Console.WriteLine("Result of division is:" & (i \ j)) Console.Read() End Sub
RUN::
DISPLAY ON THE SCREEN ::
INPUT ::
OUTPUT ::
RUN::
DISPLAY ON THE SCREEN ::
INPUT ::
OUTPUT ::
PROGRAM ::
Sub Main() Dim i, j As Integer Dim t As Boolean Console.WriteLine("Enter Number") i = Console.ReadLine() t = True For j = 2 To (i - 1) If i Mod j = 0 Then t = False Exit For End If Next j If t Then Console.WriteLine(i & " is a prime Number") Console.ReadLine() Else Console.WriteLine(i & " is not a prime Number") Console.ReadLine() End If End Sub
RUN::
DISPLAY ON THE SCREEN ::
INPUT ::
OUTPUT ::
RUN::
DISPLAY ON THE SCREEN ::
INPUT ::
OUTPUT ::
PROGRAM ::
Sub Main() Dim n, temp, i, rev As Long Console.Write("Enter the mumber : ") n = Console.ReadLine() temp = n While (n > 0) i = n Mod 10 n \= 10 rev = (rev * 10) + i End While If (rev = temp) Then Console.WriteLine(temp & " is PALINDROM.") Else Console.WriteLine(temp & " is not PALINDROM.") End If Console.ReadLine() End Sub
RUN::
DISPLAY ON THE SCREEN ::
INPUT ::
OUTPUT ::
PROGRAM ::
Imports System.Console Module Module1 Sub Main() Console.Write("Factorial of : ") Dim i As Integer = Integer.Parse(Console.ReadLine()) Console.WriteLine("Factorial of " + i.ToString + ": " + GetFactorial(i).ToString) Console.ReadKey() End Sub Function GetFactorial(ByVal value As Integer) As Integer Dim retValue As Integer = 1 Dim i As Integer For i = 2 To value retValue *= i Next Return retValue End Function End Module
RUN::
DISPLAY ON THE SCREEN ::
INPUT ::
OUTPUT ::
PROGRAM ::
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer Dim week(6) As String week(0) = "Sunday" week(1) = "Monday" week(2) = "Tuesday" week(3) = "Wednesday" week(4) = "Thursday" week(5) = "Friday" week(6) = "Saturday" For i = 0 To week.Length - 1 MsgBox(week(i)) Next End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim i As Integer Dim ItemList As New ArrayList() ItemList.Add("Ramesh") ItemList.Add("Suresh") ItemList.Add("Jayesh") ItemList.Add("Hardik") ItemList.Add("Vrinda") MsgBox("Shows Added Items") 'MsgBox(ItemList.Count()) For i = 0 To ItemList.Count - 1 MsgBox(ItemList.Item(i)) Next 'insert an item ItemList.Insert(3, "hina") 'sort itemms in an arraylist
ItemList.Sort() 'remove an item ItemList.Remove("Ramesh") 'remove item from a specified index ItemList.RemoveAt(3) MsgBox("Shows final Items the ArrayList") For i = 0 To ItemList.Count - 1 MsgBox(ItemList.Item(i)) Next End Sub End Class
RUN::
DISPLAY ON THE SCREEN ::
INPUT :: OUTPUT ::
RUN::
DISPLAY ON THE SCREEN ::
INPUT ::
OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::
PROGRAM :: RUN::
DISPLAY ON THE SCREEN :: INPUT :: OUTPUT ::