Like us on Facebook

Author Topic: The following loop for {i = 1, J = 10; i < 6; ++i, --j}  (Read 161 times)

Offline mechanic

  • Engineer
  • Hero Engineer
  • *****
  • Posts: 2253
    • View Profile
    • Engineering Forum
The following loop for {i = 1, J = 10; i < 6; ++i, --j}
« on: April 30, 2017, 12:39:08 PM »
Advertisement
Question: The following loop for {i = 1, J = 10; i < 6; ++i, --j}
                  printf{"%d %d ", i, j};

Prints?

Options are:


A. 1 10 2 9 3 8 4 7 5 6
B. 1 2 3 4 5 10 9 8 7 6
C. 1 1 1 1 1 9 9 9 9 9
D. none of the above

Correct answer is:

A. 1 10 2 9 3 8 4 7 5 6

Engineering Forum

The following loop for {i = 1, J = 10; i < 6; ++i, --j}
« on: April 30, 2017, 12:39:08 PM »

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
type: "Pakistan" without quotes: