Photo AI

A programmer has written a C# program that asks the user to input two integers and then output which of the two integers is the largest - AQA - GCSE Computer Science - Question 4 - 2021 - Paper 1

Question icon

Question 4

A-programmer-has-written-a-C#-program-that-asks-the-user-to-input-two-integers-and-then-output-which-of-the-two-integers-is-the-largest-AQA-GCSE Computer Science-Question 4-2021-Paper 1.png

A programmer has written a C# program that asks the user to input two integers and then output which of the two integers is the largest. Complete the program by fill... show full transcript

Worked Solution & Example Answer:A programmer has written a C# program that asks the user to input two integers and then output which of the two integers is the largest - AQA - GCSE Computer Science - Question 4 - 2021 - Paper 1

Step 1

Fill in the gaps with the correct types and logic

96%

114 rated

Answer

Console.Write(string num1);
int num2;

if (num1 > num2)
{
    Console.WriteLine("num1 is bigger.");
}
else if (num1 < num2)
{
    Console.WriteLine("num2 is bigger.");
}
else
{
    Console.WriteLine("The numbers are equal.");
}

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

;