Vowel - if Learn programming C#

Lesson:

Basic Data Types


Exercise:

Vowel - if


Objetive:

Create a C# 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:

using System;
public class exercise61
{
    public static void Main()
    {
        char symbol;

        Console.Write("Enter a symbol: ");
        symbol = Convert.ToChar(Console.ReadLine());

        if ((symbol == 'a') || (symbol == 'e') || (symbol == 'i') ||
                (symbol == 'o') || (symbol == 'u'))
            Console.WriteLine("It's a lowercase vowel.");
        else if ((symbol >= '0') && (symbol <= '9'))
            Console.WriteLine("It's a digit.");
        else
            Console.Write("It's another symbol.");
    }
}

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