Answer to Question #258612 in C++ for Dion Martins

Question #258612

1.1 Which of the following program segments will display odd numbers up until to 31?

a. i = 1;

while (i < 31)

{ cout << "i = " << i << endl; i = i + 2; }

b. for(int i= 0; i < 32 ; i++)

{ cout << "i = " << i << endl; }

c. for(int i= 0; i <= 31 ; i= i + 2 )

{ cout << "i = " << i << endl; }

d. for(int i= 1; i < 32 ; i= i + 2 )

{ cout << "i = " << i << endl; }


1
Expert's answer
2021-10-30T10:37:16-0400

The segment "d" will display odd numbers up until to 31


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS