Answers for "remove vowels from string in c"

C
1

Delete/remove Vowels from String in C

// Delete Vowels from String in C
/*
follow below link for best answer: 
-------------------------------------------------
https://codescracker.com/c/program/c-program-delete-vowels-from-string.htm
*/
#include<stdio.h>
#include<conio.h>
int main()
{
    char str[50];
    int i=0, j, chk;
    printf("Enter a String: ");
    gets(str);
    while(str[i]!='\0')
    {
        chk=0;
        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')
        {
            j=i;
            while(str[j-1]!='\0')
            {
                str[j] = str[j+1];
                j++;
            }
            chk = 1;
        }
        if(chk==0)
            i++;
    }
    printf("\nString (without vowels): %s", str);
    getch();
    return 0;
}
Posted by: Guest on August-17-2021
2

remove vowels in string

#include <stdio.h>
int check_vowel(char);
int main()
{
char s[100], t[100];
int c, d = 0;
gets(s);
for(c = 0; s[c] != ‘\0’; c++)
{
if(check_vowel(s[c]) == 0)
{
t[d] = s[c];
d++;
}
}
t[d] = ‘\0’;
strcpy(s, t);
printf(“%s\n”, s);
return 0;
}
int check_vowel(char ch)
{
if (ch == ‘a’ || ch == ‘A’ || ch == ‘e’ || ch == ‘E’ || ch == ‘i’ || ch == ‘I’ || ch ==’o’ || ch==’O’ || ch == ‘u’ || ch == ‘U’)
return 1;
else
return 0;
}
Posted by: Guest on September-08-2020
0

remove vowels from string in c

#include<stdio.h>
void main()
{
    char str[100];
    int i=0, j, chk;
    int count =0;

    printf("Enter a String: ");
    gets(str);

    while(str[i]!='\0')
    {
        chk=0;
        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')
        {
            count ++;
            j=i;
            while(str[j-1]!='\0')
            {
                str[j] = str[j+1];
                j++;
            }
            chk = 1;
        }
        if(chk==0)
            i++;
    }
    printf("\nString without vowels: %s", str);
    printf("\nNumbers of vowels removed: %d",count);
}
Posted by: Guest on June-23-2021

Code answers related to "remove vowels from string in c"

Code answers related to "C"

Browse Popular Code Answers by Language