Vowel - if Learn programming Visual Basic (VB.net)



Lesson:

Basic Data Types


Exercise:

Vowel - if


Objetive:

Create a Visual Basic (VB.net) program to ask the user for a symbol and respond if it's a vowel (in lowercase), a digit, or any other symbol, using "if".


Code:

Imports System
Public Class exercise61
    Public Shared Sub Main()
        Dim symbol As Char
        Console.Write("Enter a symbol: ")
        symbol = Convert.ToChar(Console.ReadLine())

        If (symbol = "a"c) OrElse (symbol = "e"c) OrElse (symbol = "i"c) OrElse (symbol = "o"c) OrElse (symbol = "u"c) Then
            Console.WriteLine("It's a lowercase vowel.")
        ElseIf (symbol >= "0"c) AndAlso (symbol <= "9"c) Then
            Console.WriteLine("It's a digit.")
        Else
            Console.Write("It's another symbol.")
        End If
    End Sub
End Class



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