A meteorologist has written a C# program that asks the user to input two atmospheric pressure readings in hectopascals (hPa) as decimal values and then outputs which of the two is the higher pressure (the greater value).
Complete the program by filling in the gaps [1] to [5] using the choices provided in Figure 1. Each option in Figure 1 should only be used once.
Figure 1
| write | press1 | press2 | input |
| else | < | > | else if |
| string | double | int | float |
double press1;
[1] press2;
Console.WriteLine("Enter the first pressure reading (hPa): ");
press1 = double.Parse(Console.ReadLine());
Console.WriteLine("Enter the second pressure reading (hPa): ");
press2 = double.Parse(Console.ReadLine());
if (press1 > press2)
{
Console.WriteLine([2] + " is higher.");
}
else if (press1 [3] press2)
{
Console.WriteLine([4] + " is higher.");
}
{
Console.WriteLine("Both pressure readings are equal.");
}
298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.