Consider the following code with a missing expression (indicated by <expression>): int z = 18; for(z 1= 5; <expression>; ) printf("this line was executed\n"); Write an expression (filling in <expression>) for which printf() will be called exactly 9 times.
Added by Martin M.
Close
Step 1
Step 1: We need to find an expression that will make the condition "5 <expression>" true, so that the printf statement will be executed. Show more…
Show all steps
Your feedback will help us improve your experience
Neel Patel and 61 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
What is the output of the following code: int x=15; if(x%2)cout<<++x; else cout<< x;
Neel P.
Suppose x, y, and z are double variables and x = 2.5, y = 6.9, and z = 10.0.What will be in the memory locations of each of the variables after each of the following statements is executed? (For each exercise, use the original declaration.) a. z *= y++ % 7; b. x = (int) y + (14 – z / 7); c. x = z / 3 * --y; d. z /= (int) y / x; e. z = x + y / 4;
Consider the expression 3 * 2^2 < 16 + 5 and also 100 / 10 * 2 > 15 - 3. Which operation is performed second?
Nick J.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
Watch the video solution with this free unlock.
EMAIL
PASSWORD