Saturday, August 18, 2018

POINTERS-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')
      {
        printf("Upper case character was entered");
        printf("\n%s",&c);
        
      }
      else if(c>='a' && c<='z')
      {
        char x=c-32;
        printf("Lower case character was entered");
        printf("\nUpper case=%s",&x);
        
      }

    return 0;
    }
  • Test Case 1

    Input (stdin)
    S
    
    
    Expected Output
    Upper case character was entered
    
    S
  • Test Case 2

    Input (stdin)
    c
    
    
    Expected Output
    Lower case character was entered
    
    Upper case=C

No comments:

Post a Comment