Advertisement
kabbo512

Upper&LowerCase Print&Count

Feb 20th, 2021
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include<conio.h>
  4. int main()
  5. {
  6.     int i;
  7.     int upper=0,lower=0;
  8.     char ch[1000],kh[1000],kb[1000];
  9.     printf("Enter the String:\n");
  10.     gets(ch);
  11.     for(i=0; ch[i]!=0; i++)
  12.     {
  13.         if(ch[i]>='A' && ch[i]<='Z')
  14.         {
  15.             upper++;
  16.  
  17.             kh[i]=ch[i];
  18.  
  19.         }
  20.  
  21.         else if(ch[i]>='a' && ch[i]<='z')
  22.         {
  23.             lower++;
  24.  
  25.             kb[i]=ch[i];
  26.  
  27.         }
  28.     }
  29.     printf("Upper Case: ");
  30.     for(i=0; kh[i]!=0; i++)
  31.     {
  32.         printf("%c",kh[i]);
  33.     }
  34.     printf("\nLower Case: ");
  35.     for(i=0; kb[i]!=0; i++)
  36.     {
  37.         printf("%c",kb[i]);
  38.     }
  39.  
  40.  
  41.     printf("\n\n lowercase letters: %d\n",lower);
  42.     printf("\n uppercase letters: %d",upper);
  43.     getch();
  44.     return 0;
  45. }
  46.  
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement