Monday, August 20, 2018

COUNTING VOWELS

  • Problem Description

    Bruno likes to find out the vowels present in the string.He wants to count the number of vowels in the string.Help Bruno by writing a code.
  • CODING ARENA::
  • #include <stdio.h>
    #include<string.h>
    int main()
    {
      char s[10];
      int count=0,i,l;
      scanf("%s",s);
      l=strlen(s);
      for(i=0;i<l;i++)
      {
        if(s[i]=='a' || s[i]=='e' || s[i]=='o' ||s[i]=='u'||s[i]=='i')
          count++;
      }
      printf("%d",count);

    return 0;
    }
  • Test Case 1

    Input (stdin)
    success
    
    
    Expected Output
    2
  • Test Case 2

    Input (stdin)
    world
    
    
    Expected Output
    1

No comments:

Post a Comment