Abdula_2314124

Untitled

Feb 27th, 2024
1,005
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. using System;
  2.  
  3. namespace HomeWorks
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string text = Console.ReadLine(); // hello
  10.             int countVowels = 0;
  11.             char[] vowelsChars = { 'a', 'e', 'o', 'y' };
  12.  
  13.             for (int i = 0; i < text.Length; i++)
  14.             {
  15.                 for (int j = 0; j < vowelsChars.Length; j++)
  16.                 {
  17.                     if (text[i] == vowelsChars[j])
  18.                     {
  19.                         countVowels++; // + 1
  20.                     }
  21.                 }
  22.             }
  23.  
  24.             Console.WriteLine(countVowels);
  25.         }
  26.     }
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment