zero_shubham1

vowels count

Jul 5th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main()
  5. {
  6.     char str_in[100],vowels[5][5];
  7.     int len,i,j,tmp;
  8.  
  9.     for(i=0;i<5;i++)
  10.     {
  11.         vowels[i][0] = "aeiou"[i];
  12.         vowels[i][1] = '0';
  13.     }
  14.  
  15.     printf("Enter your string (number of character has to be less than 100): ");
  16.     scanf("%s",str_in);
  17.  
  18.     len = strlen(str_in);
  19.     printf("Length of the string entered is %d\n",len);
  20.  
  21.     for(i=0;i<len;i++)
  22.     {
  23.         for(j=0;j<5;j++)
  24.             if(str_in[i]==vowels[j][0])
  25.             {
  26.                 tmp = (int)vowels[j][1];
  27.                 tmp++;
  28.                 vowels[j][1] = (char)tmp;
  29.             }
  30.     }
  31.  
  32.     for(i=0;i<5;i++)
  33.     {
  34.         printf("%c : %c\n",vowels[i][0],vowels[i][1]);
  35.     }
  36.  
  37.     return 0;
  38. }
Add Comment
Please, Sign In to add comment