Advertisement
BobbyGeorgiev

Untitled

Mar 2nd, 2024
999
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | Source Code | 0 0
  1. string text = Console.ReadLine();
  2.  
  3.  
  4. int countLower = 0;
  5. int countUpper = 0;
  6. int countWhiteSpace = 0;
  7.  
  8.  
  9. for  (int i = 0; i < text.Length; i++)
  10. {
  11.     char currentChar = text[i];
  12.     if (Char.IsUpper(currentChar))
  13.     {
  14.         countUpper++;
  15.     }
  16.     else if (Char.IsLower(currentChar))
  17.     {
  18.         countLower++;
  19.     }
  20.     else if (Char.IsWhiteSpace(currentChar))  
  21.     {
  22.         countWhiteSpace++;
  23.     }
  24. }
  25. Console.WriteLine(countUpper);
  26. Console.WriteLine(countLower);
  27. Console.WriteLine(countWhiteSpace);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement