Q:

C Program To Delete (Remove) Vowels From A String Using Switch Case

belongs to collection: Switch Case Basic C Programs List

0

C program to delete vowels from a string or Remove vowels string using pointers in C or C Program to Delete Vowels from String or Remove Vowels from string using pointers in C or WAP to remove vowel string using Pointer and Function or C Program to delete vowels in a string or C Program To Remove Vowels From String or C program to delete vowels from a string or C program to delete all vowels from a sentence or 

 

Explanation:

Removing vowel from a string, first we are taking an input from user and storing the string after that we use a "For loop" and Put a Condition or function If string is containing any vowels like a, e, i, o, u or A, E, I, O, U than return zero or if string does not contain any vowels than store the string into another string array and for each iteration increase the index of second string array. If we do not increase the index of a second string array then in the first index next all incoming non-vowels will be stored and replace thus our program will return the last non-vowel character as output.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<stdio.h>
#include<string.h>
int isvowel(char);

void main()
{
  char str[100],new[100];
  int i,j=0;

  printf("Enter a String 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\nString After 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;
 }
}

 

Output:

Enter a String To Remove Vowels 

nerdutella  example c programming

String After Removing Vowels: 

nrdtll xmpl c prgrmmng

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

<< C Program For Find Radius, Circumference and Volum...