लूप के लिए दो वेरिएबल x और y को एक साथ कैसे चलाएं?
How to run two variables x and y in for loop simultaneously?
A)
B)
C)
D)
Explanation:
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
for
loops. Each loop runs independently, so they do not execute simultaneously in the same loop structure. -
Option (B) is the correct one. It initializes both
x
andy
together, sets their conditions (x < m
andy < m
), and updates both variables in each iteration (x++
andy+=3
).
Correct Answer:
(B) for (x = 0, y = 0; x