Publicité
Write a recursive C function that counts the number of vowels in a str.docx
Write a recursive C function that counts the number of vowels in a str.docx
Prochain SlideShare
Write a SIMPLE java program to print out the numbers from 100 to 1- wi.docxWrite a SIMPLE java program to print out the numbers from 100 to 1- wi.docx
Chargement dans ... 3
1 sur 2
Publicité

Contenu connexe

Plus de drosa1(20)

Publicité

Write a recursive C function that counts the number of vowels in a str.docx

  1. Write a recursive C function that counts the number of vowels in a string. You may wish to call the is_element function. Solution #include <string.h> int vowels(char *str,int count) { if(!*str) return count; char ch=lower(*str); int match=ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u'; return vowels(++str, count+match); } int main(void) { int i,t, pom; char str[30]; scanf("%d", &t); for(i=0;i<t;i++) {
  2. scanf("%29s", str); pom=vowels(str,0) printf("%d ", pom); } return 0; }
Publicité