लूप के लिए दो वेरिएबल x और y को एक साथ कैसे चलाएं?
How to run two variables x and y in for loop simultaneously?
The correct way to run two variables x and y in a single for loop simultaneously involves having both variables initialized, updated, and checked together in the loop's structure.
Explanation:
-
Option (A) and Option (D) are incorrect because they represent two separate
forloops. Each loop runs independently, so they do not execute simultaneously in the same loop structure. -
Option (B) is the correct one. It initializes both
xandytogether, sets their conditions (x < mandy < m), and updates both variables in each iteration (x++andy+=3).
Correct Answer:
(B) for (x = 0, y = 0; x
Correct Answer: B) for (x = 0, y = 0; x<m, y<m; x++, y+=3)