Vowel or Consonant in C programming

Image result for c programming

Vowel or Consonant in C programming

Code:
  #include<stdio.h>
int main(){
  char in;
  char arr[11]={'a','e','i','o','u','A','E','O','U','I'};
    int i,flag=0,con=0;
  printf("Enter a character\n");
  scanf("%c",&in);
  if(((in>='a') && (in<='z'))||((in>='A')&&(in<='Z')))
  {
    for(i=0;i<10;i++)
    {
      if(in==arr[i]){
        flag++;
        break;
      }
      else
        con++;
    }
  }
  else
    printf("Not an alphabet\n");

  if(con)
    printf("Consonant");
  if(flag)
    printf("Vowel");



  return 0;
}

No comments