Photo AI

Write a C# program that inputs a character and checks to see if it is lowercase or not - AQA - GCSE Computer Science - Question 8 - 2021 - Paper 1

Question icon

Question 8

Write-a-C#-program-that-inputs-a-character-and-checks-to-see-if-it-is-lowercase-or-not-AQA-GCSE Computer Science-Question 8-2021-Paper 1.png

Write a C# program that inputs a character and checks to see if it is lowercase or not. Your program should work as follows: - gets the user to enter a character a... show full transcript

Worked Solution & Example Answer:Write a C# program that inputs a character and checks to see if it is lowercase or not - AQA - GCSE Computer Science - Question 8 - 2021 - Paper 1

Step 1

gets the user to enter a character and store it in a suitable variable

96%

114 rated

Answer

Console.WriteLine("Please enter a character:");
char userInput = Console.ReadKey().KeyChar;

Step 2

determines if the entered character is a lowercase character

99%

104 rated

Answer

if (char.IsLower(userInput)) {
    // Lowercase character
}
else {
    // Not a lowercase character
}

Step 3

outputs LOWER if the user has entered a lowercase character

96%

101 rated

Answer

if (char.IsLower(userInput)) {
    Console.WriteLine("LOWER");
}

Step 4

outputs NOT LOWER if the user has entered any other character

98%

120 rated

Answer

else {
    Console.WriteLine("NOT LOWER");
}

Join the GCSE students using SimpleStudy...

97% of Students

Report Improved Results

98% of Students

Recommend to friends

100,000+

Students Supported

1 Million+

Questions answered

;