-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathNo of vowels in String.c
51 lines (45 loc) · 1.15 KB
/
No of vowels in String.c
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Name:Sreeram SP
/* Using switch-case count the number of each vowel characters in an input string.
Process all characters until EOF. */
#include <stdio.h>
#include<string.h>
int main(void)
{
char str[100];
int a=0,e=0,i=0,o=0,u=0,n;
printf ("Enter the string :");
scanf ("%s",&str);
n=strlen(str);
for(int j=0;j<n;j++)
{
switch(str[j])
{
case'a':a++;
break;
case'A':a++;
break;
case'e':e++;
break;
case'E':e++;
break;
case'i':i++;
break;
case'I':i++;
break;
case'o':o++;
break;
case'O':o++;
break;
case'u':u++;
break;
case'U':u++;
break;
}
}
printf("Count for vowel a =%d",a);
printf("Count for vowel e =%d",e);
printf("Count for vowel i =%d",i);
printf("Count for vowel o =%d",o);
printf("Count for vowel u =%d",u);
return 0;
}