expand icon
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

Edition 7ISBN: 1285225562
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

Edition 7ISBN: 1285225562
Exercise 1

What is output by each of the pseudocode segments in Figure 5-25?

 What is output by each of the pseudocode segments in Figure 5-25?   . .

Step-by-step solution
Verified
like image
like image

Step 1 of 7

a.

Consider the pseudocode segment given in the question.

The output produced by the pseudocode segment is as follows:

    <div class=answer> a. Consider the pseudocode segment given in the question. The output produced by the pseudocode segment is as follows:     Explanation: • The variable “a” is initialized to 1, “b” is initialized to 2 and “c” is initialized to 3. • The while loop runs till the value of “a” is less than the value of “c” . o The value of “a” is incremented by 1. o The value of “b” is incremented by c i.e. every time “b” is incremented by 5. • After the while loop, the pseudocode segment displays the value of “a” as 5, “b” as 25 and “c” as 5.

Explanation:

• The variable “a” is initialized to 1, “b” is initialized to 2 and “c” is initialized to 3.

• The while loop runs till the value of “a” is less than the value of “c”.

o The value of “a” is incremented by 1.

o The value of “b” is incremented by c i.e. every time “b” is incremented by 5.

• After the while loop, the pseudocode segment displays the value of “a” as 5, “b” as 25 and “c” as 5.


Step 2 of 7


Step 3 of 7


Step 4 of 7


Step 5 of 7


Step 6 of 7


Step 7 of 7

close menu
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
cross icon