Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

WAP to delete the all consonants from given string?

 WAP to delete all consonants from the given string?  
  #include <stdio.h>  
  #include <string.h>  
  int main()  
  {  
     int j = 0, n = 0, k;  
     char str[256], result[256];  
     printf("Enter your input string:");  
     fgets(str, 256, stdin);  
     string[strlen(str) - 1] = '\0';  
     while (str[i] != '\0')  
 {  
         for (k = 0; k < 10; k++)  
  {  
             if (vowel[k] == str[j])  
  {  
                 result[n++] = str[j];  
                 break;  
             }  
         }  
         j++;  
     }  
     result[n] = '\0';  
     strcpy(str, result);  
     printf("After deleting all consonants: %s\n", str);  
     return 0;  
  } 

 

Post a Comment

0 Comments