File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+ namespace Algorithms . Strings ;
3
+
4
+ public static class Vowels {
5
+ // comment
6
+ // In main method we are reading the input and calling CountVowels method to count the vowels of a given string
7
+ // comment
8
+ public static void Main ( string [ ] args ) {
9
+ string input = Console . ReadLine ( ) ;
10
+ CountVowels ( input . Trim ( ) ) ;
11
+ }
12
+ // comment
13
+ // In CountVowels Method we are printing the count of vowels in given string
14
+ // comment
15
+ public static void CountVowels ( string input )
16
+ {
17
+ string vowels = "aeiouAEIOU" ;
18
+ int count = 0 ;
19
+ for ( int i = 0 ; i < input . Length ; i ++ )
20
+ {
21
+ for ( int j = 0 ; j < vowels . Length ; j ++ )
22
+ {
23
+ if ( input [ i ] == vowels [ j ] )
24
+ {
25
+ count += 1 ;
26
+ break ;
27
+ }
28
+ }
29
+ }
30
+ Console . WriteLine ( $ "No of Vowels in a given string is { count } ") ;
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments