Advertisement
Spocoman

02. Vowels Count

Jan 26th, 2022
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 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 input = Console.ReadLine().ToLower();
  10.             int vowels = 0;
  11.  
  12.             Console.WriteLine(PrintNumOfVowel(input, vowels));
  13.         }
  14.  
  15.         static int PrintNumOfVowel(string input,int vowels)
  16.         {
  17.             for (int i = 0; i < input.Length; i++)
  18.             {
  19.  
  20.                 int current = input[i];
  21.                 if (current == 97 || current == 101 || current == 105 || current == 111 || current == 117 || current == 121)
  22.                 {
  23.                     vowels++;
  24.                 }
  25.             }
  26.             return vowels;
  27.         }
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement