Part 3:  Looping   while(x

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Part 3:  Looping

 

while(x<y)

{

If(z<0){

x=x+a;

}

Else{

x=x+z;

z= -z

 

}

x=x+1;

}

 

Instructor Example 1:  user input:  x=5, y=2, z=5, a=5

x

y

z

a

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Instructor Example 2:  user input:  x=2, y=13, z= -1, a=4

x

y

z

a

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Looping Test Case 1:  user input:  x=2, y=18, z=10, a=2

x

y

z

a

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Looping Test Case 2:  user input:  x=1, y=6, z=0, a=10

x

y

z

a

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT