TheBulgarianWolf

Vowel Counter

Oct 30th, 2020
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2. using System.Threading;
  3.  
  4. namespace ConsoleApp1
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Console.Write("Enter your word here: ");
  11.             string word = Console.ReadLine().ToLower();
  12.             Console.WriteLine(VowelCounter(word));
  13.  
  14.         }
  15.  
  16.         static int VowelCounter(string word)
  17.         {
  18.             int counter = 0;
  19.             foreach(char i in word)
  20.             {
  21.                 if(i == 'a' || i == 'i' || i == 'o' || i == 'u' || i == 'e')
  22.                 {
  23.                     counter++;
  24.                 }
  25.             }
  26.             return counter;
  27.         }
  28.  
  29.     }
  30. }
  31.  
Add Comment
Please, Sign In to add comment