Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _2._VowelsCount
- {
- class VowelsCount
- {
- static void Main()
- {
- string word = Console.ReadLine();
- string output = GetVowelsCount(word);
- Console.WriteLine(output);
- }
- static string GetVowelsCount(string word)
- {
- int count = 0;
- for (int i = 0; i < word.Length; i++)
- {
- char currentLetter = word[i];
- bool conditionA = currentLetter == 'a' || currentLetter == 'A';
- bool conditionE = currentLetter == 'e' || currentLetter == 'E';
- bool conditionI = currentLetter == 'i' || currentLetter == 'I';
- bool conditionO = currentLetter == 'o' || currentLetter == 'O';
- bool conditionU = currentLetter == 'u' || currentLetter == 'U';
- bool conditionY = currentLetter == 'y' || currentLetter == 'Y';
- if (conditionA || conditionE || conditionI || conditionO || conditionU || conditionY)
- {
- count++;
- }
- }
- string counter = count.ToString();
- return counter;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement