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

// Declare a variable to hold the input character
char inputChar;

// Prompt the user for input
Console.WriteLine("Please enter a character:");

// Read input and store it
inputChar = Console.ReadKey().KeyChar;

Step 2

determines if the entered character is a lowercase character

99%

104 rated

Answer

// Check if the character is lowercase
if (char.IsLower(inputChar)) {
    // If it is lowercase, output LOWER
    Console.WriteLine("LOWER");
} else {
    // If it is not lowercase, output NOT LOWER
    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

;