Solved programming problem

Replace Vowels from a String in C.

Source code

int main()

{

    char str[100];

    int i=0;

    printf("Please Enter a Massage: ");

    gets(str); ///scan string

    while(str[i]!='�')

    {

        if(str[i]=='a'|| str[i]=='e'|| str[i]=='i'|| str[i]=='o'|| str[i]=='u') ///checking the vowels

        {

            str[i]='#'; ///replace the vowels with "#";

            i++;

        }

        else i++;

    }

    printf("Your new massage: ");

    puts(str);///printing

    return 0;

}

Output

Please Enter a Massage:apple


Your new message:#ppl#

Join the discussion

Add your comment