+ 1
Need help with vowel counter in C#
namespace Sololearn { class Program { static void Main(string[] args) { int count = 0; string words = Console.ReadLine(); char[] vowels = {'a','e','i','o','u','A','E','I','O','U'}; foreach (char i in vowels) if (words.Contains(i)) { count++; Console.WriteLine(i); } Console.WriteLine(count); } } } Ive almost got it figured out. I know my issue is that it's not counting vowels more than once. I just can't figure out how to make it work right. Thanks in advance!
2 Answers
+ 3
Instead of checking whether letters in vowels are in words check whether letters in words are in vowels.
+ 2
Thanks that totally worked.