Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace vowelsCount
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string word = Console.ReadLine().ToLower();
  10.             Console.WriteLine(GetCountOfVowels(word));
  11.         }
  12.  
  13.         static int GetCountOfVowels(string word)
  14.         {
  15.             int count = 0;
  16.             for (int i = 0; i < word.Length; i++)
  17.             {
  18.                 if(word[i] == 'a' || word[i] == 'e' || word[i] == 'i' || word[i] == 'o' || word[i] == 'u')
  19.                 {
  20.                     count++;
  21.                 }
  22.             }
  23.             return count;
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement