Write a Program To Remove Vowels From String Using Switch Case - Write a Program To Remove Vowels From String in C Language

 Write a Program To Remove Vowels From String in C Language

#include<stdio.h>

#include<string.h>

int isvowel(char);

void main()

{

      char str[50],new[50];

      int i,j=0;

     printf("Enter words to remove vowels\n\n");

      gets(str);

      for(i = 0; str[i] != '\0'; i++)

      {

       if(isvowel(str[i]) == 1)

       {

        new[j] = str[I];

        j++;

       }

      }

      new[j] = '\0';

     printf("\n\nAfter Removing Vowels: \n\n%s", new);

     getch();

}

int isvowel(char ch)

{

  switch(ch)

  {

   case 'a':
   case 'e':
   case 'i':
   case 'o':
   case 'u':
   case 'A':
   case 'E':
   case 'I':
   case 'O':
   case 'U':
   return 0;
   default:

   return 1;

 }

}

इस कोड को हमने CODEBLOCK पर बना कर run किया है


OUTPUT

Comments