Thursday, September 13, 2018

POINTER -30


  • Problem Description

    Write a program which takes an input from the user and then checks whether its a number or a character . If its a character ,determine whether it is in upper case or lower case

    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 c;
      scanf("%s",&c);
      if(c>='A' && c<='Z')
      {
        char z=c+32;
        printf("Input is upper case\n");
        printf("Lower case=%s",&z);
      }
      else if(c>='a' && c<='z')
      {
        char x=c-32;
        printf("Input is lower case\n");
        printf("Upper case=%s",&x);
      }
    return 0;
    }
  • Test Case 1

    Input (stdin)
    S
    
    
    Expected Output
    Input is upper case
    
    Lower case=s
  • Test Case 2

    Input (stdin)
    c
    
    
    Expected Output
    Input is lower case
    
    Upper case=C

No comments:

Post a Comment