Saturday, August 18, 2018

POINETRS-6

  • Problem Description

    Write a program to input a character and Categorize it as a vowel and consonant

    Input and Output Format:

    Refer sample input and output for formatting specification.

    All float values are displayed correct to 2 decimal places.

    All text in bold corresponds to input and the rest corresponds to output.

  • CODING ARENA::
  • #include <stdio.h>
    int main()
    {
      char ch;
      int up,low;
      scanf("%s",&ch);
      low=(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u');
      up=(ch=='A' || ch=='E' || ch=='O' || ch=='I' || ch=='U');
      if(up || low)
        printf("vowel");
      else
        printf("consonant");
      return 0;
    }
  • Test Case 1

    Input (stdin)
    e
    
    
    Expected Output
    vowel
  • Test Case 2

    Input (stdin)
    b
    
    
    Expected Output
    consonant

No comments:

Post a Comment