Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace VowelsCount
- {
- class Program
- {
- static void Main(string[] args)
- {
- string word = Console.ReadLine();
- int vowelCount = GetVowelsCount(word);
- Console.WriteLine(vowelCount);
- }
- static int GetVowelsCount(string word)
- {
- char[] vowel = new char[] { 'a', 'e', 'i', 'o', 'u' };
- int vowelCount = 0;
- foreach (char ch in word.ToLower())
- {
- if (vowel.Contains(ch))
- {
- vowelCount++;
- }
- }
- return vowelCount;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement