Skip to content

Instantly share code, notes, and snippets.

@Chubek
Created June 26, 2016 05:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Chubek/c60705a4ee6d97babc53fcb066cd474b to your computer and use it in GitHub Desktop.
Counts Vowels
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CountVowels
{
class Program
{
static void Main(string[] args)
{
string word = Console.ReadLine();
char[] wordSplit = word.ToCharArray();
int vowelCount = 0;
for (int i = 0; i < wordSplit.Length; i++)
{
if (wordSplit[i] == 'e' || wordSplit[i] == 'a' || wordSplit[i] == 'u' || wordSplit[i] == 'i' || wordSplit[i] == 'o' ||
wordSplit[i] == 'E' || wordSplit[i] == 'A' || wordSplit[i] == 'U' || wordSplit[i] == 'I' || wordSplit[i] == 'O')
{
vowelCount += 1;
}
else
continue;
}
Console.WriteLine(vowelCount);
Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment