using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace vowel_count
{
class Program
{
static void Main(string[] args)
{
char[] str = new char[10];
Console.WriteLine("enter a string(Max 10 char):");
str = Console.ReadLine().ToCharArray();
int i = 0;
int vowels=0;
for (i = 0; i < str.Length; i++)
{
if (str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U' ||
str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u')
{
vowels++;
}
}
Console.WriteLine("the number of vowels {0}", vowels);
Console.ReadKey();
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace vowel_count
{
class Program
{
static void Main(string[] args)
{
char[] str = new char[10];
Console.WriteLine("enter a string(Max 10 char):");
str = Console.ReadLine().ToCharArray();
int i = 0;
int vowels=0;
for (i = 0; i < str.Length; i++)
{
if (str[i] == 'A' || str[i] == 'E' || str[i] == 'I' || str[i] == 'O' || str[i] == 'U' ||
str[i] == 'a' || str[i] == 'e' || str[i] == 'i' || str[i] == 'o' || str[i] == 'u')
{
vowels++;
}
}
Console.WriteLine("the number of vowels {0}", vowels);
Console.ReadKey();
}
}
}
No comments:
Post a Comment