VB.Net Console Application Practical

AIMs:-

  1. Print Welcome to Console Application in Console Application.
  2. Find Sum of Two variables in Console Application.
  3. Create a module Maxmin and Access main module function mm().
  4. Perform Arithmetic Operations in Console Application.
  5. Find given Number is Positive,Negative or Zero.
  6. Find Maximum and Minimum value from three numbers.

1 & 2.
Module Module1

    Sub Main()
        Console.WriteLine("Welcome to Console Application")
        Dim a As Integer
        Dim b As Integer
        a = 20
        b = 10
        Console.WriteLine("Sum =" & a + b)
        Maxmin.mm()
        Arith.art()
        PNZ.PoNeZo()
        Console.ReadKey()
    End Sub

End Module
3 & 6. 
   Module Maxmin
    Sub mm()
        Dim p, q, r As Integer
        Console.WriteLine("Enter p,q,r:")
        p = CInt(Console.ReadLine())
        q = CInt(Console.ReadLine())
        r = CInt(Console.ReadLine())
        If p > q Then
            If p > r Then
                Console.WriteLine(p & " is Greater.")
            Else
                Console.WriteLine(r & " is Greater.")
            End If
        End If
        If q > r Then

            Console.WriteLine(q & " is Greater.")
        Else
            Console.WriteLine(r & " is Greater.")
        End If
        If p < q Then
            If p < r Then
                Console.WriteLine(p & " is Minimum.")
            Else
                Console.WriteLine(r & " is Minimum.")
            End If
        End If
        If q < r Then

            Console.WriteLine(q & " is Minimum.")
        Else
            Console.WriteLine(r & " is Minimum.")
        End If
        Console.ReadKey()

    End Sub
End Module
4. 
   Module Arith
    Sub art()
        Dim a, b, c, d, e As Integer
        Dim f As Double
        Console.WriteLine("Enter a,b:")
        a = CInt(Console.ReadLine())
        b = CInt(Console.ReadLine())
        c = a + b
        d = a - b
        e = a * b
        f = a / b
        Console.WriteLine("Addition=" & c)
        Console.WriteLine("Subtraction=" & d)
        Console.WriteLine("Multiplication" & e)
        Console.WriteLine("Division=" & f)
        Console.ReadKey()

    End Sub

End Module

5.
    Module PNZ
    Sub PoNeZo()
        Dim i As Integer
        Console.WriteLine("Enter i:")
        i = CInt(Console.ReadLine())
        If i > 0 Then
            Console.WriteLine(i & " is Positive.")
        ElseIf i < 0 Then
            Console.WriteLine(i & " is Negative.")
        Else
            Console.WriteLine(i & " is Zero.")
        End If
        Console.ReadKey()

    End Sub

End Module



Output:-


Thank You

Comments

Popular Posts