Testing if a character is in a word

From TRCCompSci - AQA Computer Science
Revision as of 08:59, 15 June 2023 by Admin (talk | contribs) (Created page with " Console.WriteLine("please enter a word:"); string word = Console.ReadLine(); string vowels = "aeiou"; foreach(char c in word) { if(vowels.Contains(c.ToString()...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Console.WriteLine("please enter a word:"); string word = Console.ReadLine(); string vowels = "aeiou";

foreach(char c in word) { if(vowels.Contains(c.ToString())) { Console.WriteLine("Vowel found: "+c); } }

Console.ReadLine();