Home » C solved programs » C string programs

C program to eliminate all vowels from a string

In this C program, we are going to learn how to eliminate all vowels from a given string? Here, we have a string that may contain consonants, vowels etc we have to remove only vowels from it.
Submitted by IncludeHelp, on April 05, 2018

Given a string and we have to eliminate/ remove all vowels from the string using C program.

To eliminate/remove the vowels

  • We will traverse (reach) each elements by using a loop
  • And, check the each element, if any element found as vowel, we will remove that shifting all other elements to the left
  • Finally, we will print the string - that will be a string without the vowels


    String is: "Hello World"
    String after removing vowels: "Hll Wrld"

Program to eliminate all vowels from the string in C

/* C program to eliminate all the vowels
* from the entered string
#include <stdio.h>
#include <string.h>

int main()
	char string[50]={0};
	int length=0,i=0,j=0,k=0;

	printf("\nEnter the string : ");

	length = strlen(string);

			case 'a':
			case 'A':
			case 'e':
			case 'E':
			case 'i':
			case 'I':
			case 'o':
			case 'O':
			case 'u':
			case 'U':
					string[k] = string[k+1];
					//printf("\nstring : %s",string);
			default : continue;
	printf("Final string is : %s",string);
	return 0;


Enter the string : Hello World
Final string is : Hll Wrld

Was this page helpful? Please share with your friends...

Are you a blogger? Join our Blogging forum.

Comments and Discussions

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com (2015-2018), Some rights reserved.

close Like other websites, this site uses cookies to deliver relevant ads based on your interest, by using our website, you acknowledge that you have read our privacy policy.