using System;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Char[] s = new char[100];
int i, vows = 0, consont = 0, specl = 0, n;
Console.WriteLine("Enter the Lenth of the sentence");
n = int.Parse(Console.ReadLine());
Console.WriteLine("Please Enter the sentence more then given length ");
for (i = 0; i < n; i++)
{
s[i] = Convert.ToChar(Console.Read());
}
for (i = 0; s[i] != '\0'; i++)
{
if ((s[i] == 'a' || s[i] == 'e' || s[i] == 'i' || s[i] == 'o' || s[i] == 'u') || (s[i] == 'A' || s[i] == 'E' || s[i] == 'I' || s[i] == 'O' || s[i] == 'u'))
{
vows = vows + 1;
}
else
{
consont = consont + 1;
}
if (s[i] == '*' || s[i] == '\0' || s[i] == '@' || s[i] == '$' || s[i] == '%')
{
specl = specl + 1;
}
}
consont = consont - specl;
Console.WriteLine("Number of vowels: {0}", vows);
Console.WriteLine("Number of consonet: {0}", consont);
Console.WriteLine("Numbers of Special: {0}", specl);
Console.ReadLine();
Console.ReadLine();
Console.ReadLine();
}
}
}
Output:
No comments:
Post a Comment