Advertisement
tissiana

VowelsCount

Oct 24th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace VowelsCount
  8. {
  9.     class Program
  10.     {
  11.        
  12.         static void Main()
  13.         {
  14.             PrintVowelsCount();
  15.         }
  16.         public static void PrintVowelsCount()
  17.         {
  18.             string inputString = Console.ReadLine().ToLower();
  19.             int vowelCounts = 0;
  20.  
  21.             for (int i = 0; i < inputString.Length; i++)
  22.             {
  23.                 bool isVowel = (char)inputString[i] == 97 || (char)inputString[i] == 101 || (char)inputString[i] == 105 || (char)inputString[i] == 111 || (char)inputString[i] == 117;
  24.  
  25.                 if(isVowel)
  26.                 {
  27.                     vowelCounts += 1;
  28.                 }
  29.             }
  30.             Console.WriteLine(vowelCounts);
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement