Two negative numbers Learn programming Visual Basic (


Flow Control


Two negative numbers


Create a Visual Basic ( program to prompt the user for two numbers and determine if both numbers are negative or not.


Imports System
Public Class exercise26
    Public Shared Sub Main()
        Dim number1 As Integer
        Dim number2 As Integer
        Console.Write("number 1: ")
        number1 = Convert.ToInt32(Console.ReadLine())
        Console.Write("number 2: ")
        number2 = Convert.ToInt32(Console.ReadLine())
        If (number1 < 0) AndAlso (number2 < 0) Then Console.WriteLine("the numbers are negative")
        If Not ((number1 < 0) AndAlso (number2 < 0)) Then Console.WriteLine("the numbers are NOT negative")
    End Sub
End Class

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