print all vowels and consonants characters separately

C program to print all vowels and consonants characters separately.

Program

#include<stdio.h>
#include<conio.h>
#define MAX 50

void main()
{
	char str[MAX], vowel[MAX], conso[MAX];
    int i, n_vowel, n_conso;

    printf("Enter the string\t:");
    gets(str);

    i = 0;
    n_vowel = 0;
    n_conso = 0;

    while(str[i] != '\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')
        {
            vowel[n_vowel] = str[i];
            n_vowel++;
        }
        else if((str[i]>='A' && str[i]<='Z') || (str[i]>='a' && str[i]<='z'))
        {
            conso[n_conso] = str[i];
            n_conso++;
        }
        i++;
    }
    vowel[n_vowel] = '\0';
    conso[n_conso] = '\0';

    printf("\nVowels in the string are\t:%s",vowel);
    printf("\nconsonants in the string are\t:");
    puts(conso);

    getch();
}

Output

Enter the string        :Welcome to coursecrux.com

Vowels in the string are        :eoeooueuo
consonants in the string are    :Wlcmtcrscrxcm