Thursday, September 13, 2018

COUNT THE UPPER AND LOWER CASE

  • Problem Description

    Count Total number of Capital and Small Letters from Accepted Linen
    Note: (No spaces between words)
  • CODING ARENA
  • #include <stdio.h>
    int main()
    {
      int cu=0,cl=0;
      char str[100];
      int counter;
      scanf("%s",str);
      for(counter=0;str[counter]!='\0';counter++)
      {
        if(str[counter]>='A' && str[counter]<='Z')
          cu++;
        else if(str[counter]>='a' && str[counter]<='z')
          cl++;
      }
      printf("Uppercase Letters:%d",cu);
      printf("\nLowercase Letters:%d",cl);
      return 0;
    }
  • Test Case 1

    Input (stdin)
    SRMUn
    
    
    Expected Output
    Uppercase Letters:4
    
    Lowercase Letters:1
  • Test Case 2

    Input (stdin)
    SRMUniversityLearningCENTRE
    
    
    Expected Output
    Uppercase Letters:11
    
    Lowercase Letters:16

No comments:

Post a Comment