Testing if a character is in a word

From TRCCompSci - AQA Computer Science
Revision as of 11:41, 15 June 2023 by Admin (talk | contribs)
Jump to: navigation, search
 1 Console.WriteLine("please enter a word:");
 2 string word = Console.ReadLine();
 3 string vowels = "aeiou";
 4 		
 5 foreach(char c in word)
 6 {
 7 	if(vowels.Contains(c.ToString()))
 8 	{
 9 		Console.WriteLine("Vowel found: "+c);
10 	}
11 }
12 	
13 Console.ReadLine();