Question
Examine each pseudo code fragment in problems and write what will be printed. Each problem starts by listing out the values that will be entered
Examine each pseudo code fragment in problems and write what will be printed. Each problem starts by listing out the values that will be entered by the user. The pseudocode is between begin and end statements. When reading a line like input a number into refer to the inputs above the code and imagine the values being entered in the order they are listed.
1. The user enters 7 as input.
begin
input a number into x
print x
end
Printed:
2. The user enters 7 as input.
begin
input a number into x
set y to x + 5
print y
end
Printed:
3. The following code prompts thrice for numbers. Suppose the user enters 6, 8, and 16 as
input for the three numbers.
begin
input a number into a
input a number into b
input a number into c
set x to (a + b + c) / 5
print x
end
Printed:
4. The following code prompts twice for numbers. The user enters 10 and then 20 for the
two numbers.
begin
input a number into p
input a number into q
set r to p + q
set s to r * 3 2
print p + s
end
Printed:
5. The following code prompts twice for numbers. The user enters 13 and then 5 for the
two numbers.
begin
input a number into x
input a number into y
set z to 2 * x + y
print (z + 9) / 4
end
Printed:
6. The following code prompts thrice for numbers. Suppose the user enters 6, 7, and 8 as
input for the three numbers.
begin
input a number into a
input a number into b
input a number into c
print (a + b + c) / 3
end
Printed:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started