Advertisement
Aminpro

[ECP 1016]Tutorial 9 Question 7

Aug 26th, 2012
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. //https://www.facebook.com/AminproPastebin
  2.  
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. int main(void)
  7. {
  8.    
  9.     char word[50];
  10.     char vowel[20];
  11.     char consonant[20];
  12.     int i, vcount=0, ccount=0, len=0;
  13.     printf("<* VOWEL & CONSONANT CHECKER *>");
  14.  
  15.     printf("Please enter a word: ");
  16.     fgets(word,50, stdin );
  17.     len = strlen(word);
  18.     printf("Numeber or letter : %d", len);
  19.  
  20.     for (i=0; i<len; i++){
  21.         if (word[i]=='a'||word[i]=='e'||word[i]=='i'||word[i]=='o'||word[i]=='u'){
  22.             vowel[vcount]= word[i];
  23.             vcount++;
  24.         }
  25.        
  26.         else{
  27.             consonant[ccount]= word[i];
  28.             ccount++;
  29.         }
  30. }
  31.     printf("\nNumber of vowel: %d ->", vcount);
  32.     for(i=0; i<vcount; i++){
  33.     printf("%c", vowel[i]); }
  34.     printf("\nNumber of consonant: %d ->", ccount);
  35.     for(i=0; i<ccount; i++){
  36.     printf("%c", consonant[i]); }
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.    
  44.     return (0);
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement