Horje
count number of vowels in a string in c Code Example
count number of vowels in a string in c
 #include<stdio.h>
  2 int num_vowels(char*);
  3 void main()
  4 {
  5 char s[10];
  6 int c;
  7 printf("Enter the string...\n");
  8 scanf("%s",s);
  9 c=num_vowels(s);
 10 printf("%d",c);
 11 printf("\n");
 12 }
 13 int num_vowels(char*s)
 14 {
 15 int c=0;
 16 int i;
 17
 18 for(i=0;s[i]!='\0';i++)
 19 if(s[i]=='a'||s[i]=='e'||s[i]=='i'||s[i]=='o'||s[i]=='u'||s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U')
 20 c++;
 21 return c;
 22 }
 23
 24
 25
 26
 27
 28
~             




C

Related
save numpy array to text file Code Example save numpy array to text file Code Example
font awsome circle info icon Code Example font awsome circle info icon Code Example
sigaction in c Code Example sigaction in c Code Example
populate a map c++ Code Example populate a map c++ Code Example
c program to find area of circle Code Example c program to find area of circle Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11