- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to delete the vowels from a given string using C language?
The logic we use to implement to delete the vowels from the given string is as follows −
for(i=0; i<len; i++) //repeat until i<len{ if(str[i]=='a' || str[i]=='e' || str[i]=='i' || //checking to delete the vowels str[i]=='o' || str[i]=='u' || str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U'){ for(j=i; j<len; j++){ str[j]=str[j+1]; } len--; } }
Example
Following is the C program for deleting the vowels in a given string −
#include<stdio.h> #include<conio.h> #include<string.h> void main(){ char str[20]; int len, i, j; clrscr(); printf("Please Enter any String: "); gets(str); len=strlen(str); for(i=0; i<len; i++){ if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u' || str[i]=='A' || str[i]=='E' || str[i]=='I' || str[i]=='O' || str[i]=='U'){ for(j=i; j<len; j++){ str[j]=str[j+1]; } len--; } } printf("After Deleting the vowels, the String is: %s",str); getch(); }
Output
When the above program is executed, it produces the following result −
Please Enter any String: TutorialsPoint After Deleting the vowels, the String is: TtralsPint
- Related Articles
- How to find the vowels in a given string using Java?
- How to count number of vowels and consonants in a string in C Language?
- How to remove vowels from a string using regular expressions in Java?
- How to delete a character from a string using python?
- Remove vowels from a String in C++
- First X vowels from a string in C++
- Python program to count the number of vowels using set in a given string
- Python program to count the number of vowels using sets in a given string
- Java program to delete duplicate characters from a given String
- C++ Program to count Vowels in a string using Pointer?
- Python program to count number of vowels using set in a given string
- Delete a tail node from the given singly Linked List using C++
- To count Vowels in a string using Pointer in C++ Program
- How to Count the Number of Vowels in a string using Python?
- Count the pairs of vowels in the given string in C++

Advertisements