Advertisement
optybg

Untitled

Feb 15th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CountOfCapitalLettersInArray7
  4. //Read an array of strings and find out how many of them
  5. //are capital English letters(such as A, B, C etc.).
  6. // Print the count on the console.
  7.  
  8. {
  9.     public class CountOfCapitalLettersInArray7
  10.     {
  11.         public static void Main(string[] args)
  12.         {
  13.             string someWors = Console.ReadLine();
  14.  
  15.             var counter = 0;
  16.  
  17.             for (int i = 0; i < someWors.Length; i++)
  18.             {
  19.                 if (someWors[i]>=65 && someWors[i]<=90)
  20.                 {
  21.                     counter++;
  22.                 }
  23.  
  24.             }
  25.  
  26.             Console.WriteLine(counter);
  27.         }
  28.  
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement