-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvowelCount.cs
More file actions
28 lines (24 loc) · 735 Bytes
/
Copy pathvowelCount.cs
File metadata and controls
28 lines (24 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public static void GetVowelCount(string str)
{
string str ="";
string finalResult = "";
// This method takes the user input and counts the number of vowels in the given string
// It works iteratively
private void GetVowelCount()
{
str = str.ToLower();
int count = 0;
for (int i = 0; i < str.Length; i++)
{
if (str[i] == 'a' ||
str[i] == 'e' ||
str[i] == 'i' ||
str[i] == 'o' ||
str[i] == 'u')
{
count++;
}
}
finalResult = count.ToString();
}
}