Positive and negative Learn programming Visual Basic (VB.net)

Lesson:

Flow Control


Exercise:

Positive and negative


Objetive:

Write a Visual Basic (VB.net) program to get a number and answer whether it is positive or negative.


Code:

Imports System
Public Class exercise15
    Public Shared Sub Main()
        Dim a As Integer
        Console.Write("Enter a number: ")
        a = Convert.ToInt32(Console.ReadLine())
        If a > 0 Then Console.WriteLine("is positive")
        If a < 0 Then Console.WriteLine("is negative")
    End Sub
End Class

Juan A. Ripoll - Systems Tutorials and Programming Courses ©  All rights reserved.  Legal Conditions.