Thursday, September 13, 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 a[100];
      int len,i,vow=0;
      scanf("%s",a);
      len=strlen(a);
      for(i=0;i<len;i++)
      {
        if(a[i]=='a'||a[i]=='A'||a[i]=='e'||a[i]=='E'||a[i]=='i'||a[i]=='I'||a[i]=='o'||a[i]=='O'||a[i]=='u'||a[i]=='U')
          vow=vow+1;
      }
      printf("%d",vow);

    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