C # According to the user input string, there are several output uppercase letters, lowercase letter has several

Source: Internet
Author: User

static void Main (string[] args)
{

Depending on the user input string, there are several uppercase and lowercase letters in the output.
Console.WriteLine ("Please enter a line in English code");
string s = Console.ReadLine (); Accepts the input value with a string.
int i = 0;
Int J = 0;//I is the number of uppercase, and j is the lowercase number.
foreach (char s1 in s)
{
if (S1 >= ' A ' && s1 <= ' Z ')
{
i++;
}
else if (s1>= ' a ' &&s1<= ' Z ')
{
j + +;
}
Continue If you don't enter an English letter, you jump out of the loop.
}
Console.WriteLine ("There are {0} in uppercase letters, and {1} for lowercase characters.") ", i,j);

}

Operation Result:

C # According to the user input string, there are several output uppercase letters, lowercase letter has several

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.