Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace methods_exerci
- {
- class Program
- {
- static void Main(string[] args)
- {
- string text = Console.ReadLine().ToLower();
- Console.WriteLine(Vowels(text));
- }
- static int Vowels (string text)
- {
- int vowels = 0;
- for (int i = 0; i < text.Length; i++)
- {
- char word = text[i];
- switch(word)
- {
- case 'a':
- vowels++;
- break;
- case 'o':
- vowels++;
- break;
- case 'e':
- vowels++;
- break;
- case 'i':
- vowels++;
- break;
- case 'u':
- vowels++;
- break;
- case 'y':
- vowels++;
- break;
- }
- }
- return vowels;
- }
- }
- }
Add Comment
Please, Sign In to add comment