Write a C# Sharp program to check whether an alphabet is a vowel or consonant
- برمجة سي شارب
- برمجة
- 2021-05-17
- MarwaMohammed
الأجوبة
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class exercise16
{
static void Main(string[] args)
{
char ch;
Console.Write("\n\n");
Console.Write("check whether the input alphabet is a vowel or not:\n");
Console.Write("-----------------------------------------------------");
Console.Write("\n\n");
Console.Write("Input an Alphabet (A-Z or a-z) : ");
ch = Convert.ToChar(Console.ReadLine().ToLower());
int i=ch;
if(i>=48 && i<=57)
{
Console.Write("You entered a number, Please enter an alpahbet.");
}
else
{
switch (ch)
{
case 'a':
Console.WriteLine("The Alphabet is vowel");
break;
case 'i':
Console.WriteLine("The Alphabet is vowel");
break;
case 'o':
Console.WriteLine("The Alphabet is vowel");
break;
case 'u':
Console.WriteLine("The Alphabet is vowel");
break;
case 'e':
Console.WriteLine("The Alphabet is vowel");
break;
default:
Console.WriteLine("The Alphabet is not a vowel");
break;
}
}
Console.ReadKey();
}
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال