Sunday, 20 March 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 ( * )




Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment