20/03/2016

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

Problem:- 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 

Check This:- Hacker rank solution for Strings, Classes, STL, Inheritance in C++.

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.


Also Check:- Geeksforgeeks solution for School, Basic, Easy, Medium, Hard in C++.

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date for a new post or if you have any Query you can ask there with lots of coders also suggest to your Friends to join and like our page, so we can help our community, and don't forget to Subscribe. Enter your Email and click to subscribe.


Solution:-

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

void main()
{
/* Visit - www.programmingwithbasics.com*/

  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:-

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

You May Also See


1. C Program For Check String Is Palindrome Or Not Using For Loop

2. C Program For Convert All Input String Simultaneously Into Asterisk ( * )




Previous Post
Next Post

post written by:

Hi, I’m Ghanendra Yadav, SEO Expert, Professional Blogger, Programmer, and UI Developer. Get a Solution of More Than 500+ Programming Problems, and Practice All Programs in C, C++, and Java Languages. Get a Competitive Website Solution also Ie. Hackerrank Solutions and Geeksforgeeks Solutions. If You Are Interested to Learn a C Programming Language and You Don't Have Experience in Any Programming, You Should Start with a C Programming Language, Read: List of Format Specifiers in C.
Follow Me

0 Comments: