Sunday, May 3, 2015

finding even or odd

 Dim j As Integer
        Console.WriteLine("please enter a values")
        j = Console.ReadLine


        If j Mod 2 = 0 Then
            Console.WriteLine("even")
        Else
            Console.WriteLine("odd")
        End If

        Console.ReadLine()

If Loop


        Dim s As String
        Console.WriteLine("pelase enter a pet name")
        s = Console.ReadLine
        If s = "cat" Then
            Console.WriteLine("you like cats")
        ElseIf s = "dog" Then
            Console.WriteLine("you like dogs")

        Else
            Console.WriteLine("you are not typed any predefined pets")
        End If


        Console.ReadLine()

Create a class and Object

Class a
        Function display()
         Console.WriteLine("hello world")
        End Function
End Class

    Sub Main()

        Dim o As a = New a()
        o.display()
        Console.ReadLine()
    End Sub

Do While

Dim i As Integer = 1
        Do While i <= 10
            Console.WriteLine(i)
            i += 1

        Loop

While Loop

Dim i As Integer
        i = 1
        While (i <= 10)
            Console.WriteLine(i)

            i += 1

        End While

For Loop

        For a As Integer = 1 To 10
            Console.WriteLine(a)
        Next