Sunday, 31 March 2013
C# (C Sharp) - Program to Check entered character is vowel or not vowel
PROGRAM TO IMPLEMENT VOWEL ( TO CHECK ENTERED CHARACTER IS VOWEL OR NOT)
ALSO TO CHECK No. Of VOWEL CHARACTER ENTERED
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace vowel
{
class Program
{
static void Main(string[] args)
{
int a=0, b=0;
Console.WriteLine(" Enter the number of character ");
int tot = Convert.ToInt32(Console.ReadLine());
char[] ch = new char[tot];
Console.WriteLine(" Enter {0} Characters ", tot);
for (int i = 0; i < tot; i++)
{
ch[i] = Convert.ToChar(Console.ReadLine());
}
for (int i = 0; i < tot; i++)
{
if (ch[i] == 'a' || ch[i] == 'e' || ch[i] == 'i' || ch[i] == 'o' || ch[i] == 'u' || ch[i] == 'A' || ch[i] == 'E' || ch[i] == 'I' || ch[i] == 'O' || ch[i] == 'U')
{
a++;
}
else
{
b++;
}
}
Console.WriteLine(" No. of VOWEL is {0}", a);
Console.WriteLine(" No. of Non VOWEL is {0}", b);
Console.ReadLine();
}
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment