belongs to collection: all conditional programs in c# language
I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
using System; public class charpexercise { static void Main(string[] args) { char ch; Console.WriteLine("Enter any character: "); ch = Convert.ToChar(Console.ReadLine()); // Condition for vowel checking if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u' || ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') { Console.WriteLine(ch + " is Vowel."); } else if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) { Console.WriteLine(ch + " is Consonant."); } Console.ReadLine(); } }
Result:
Enter any character:
a
a is Vowel.
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
I have used Visual Studio 2012 for debugging purpose. But you can use any version of visul studio as per your availability.
Result:
Enter any character:
a
a is Vowel.
need an explanation for this answer? contact us directly to get an explanation for this answer