Check alphabet is consolent or vowel by '2' methods

 


Check alphabet is consolent or vowel method 1

METHOD - 1

#include<stdio.h>
int main()
{
  char ch;
  printf("enter a digit\n");
  scanf("%c",&ch);
  switch(ch)
  {
    case 'A':
    printf("vowel");
    break;
    case 'E':
    printf("vowel");
    break;
    case 'I':
    printf("vowel");
    break;
    case 'O':
    printf("vowel");
    break;
    case 'U':
    printf("vowel");
    break;

    default:
    printf("INVALID CHOICE");
  }
}


METHOD - 2


#include<stdio.h>
int main()
{
  char ch;
  printf("enter any alphabet\n");
  scanf("%c",&ch);
  switch(ch)
  {
    case 'a':
    case 'e':
    case 'i':
    case 'o':
    case 'u':

    printf("vowel");
    break;
    default:
    printf("consolent");
  }
}




Post a Comment

0 Comments