What will be the output of the following C programming code:int i, j;
for(i=1; i<5; i+=2)
for(j=1; j<i; j+=2)
printf("%d", j);
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: A. 1
Explanation
The outer loop runs for i = 1 and i = 3. For i = 1 the inner condition j < 1 is false immediately. For i = 3, j = 1 prints 1, then j becomes 3 and 3 < 3 is false. Output: 1.More Programming Languages and Computer Graphics questions
- What would be the equivalent pointer expression for referring the array element ar[m][n][0]?
- Which of the following techniques is used for Clipping?
- Consider the following piece of C programming code:int x=128, y=110; do { if(x>y) x=x-y; else y=y-x; } while(x!=y); printf("%d",x); Which o…
- Match List I with List IIList I List II A. Overloading I. Since function call is resolved during run time, the execution is slow. B. Early…
- Consider the following statements for XML (Extensible Markup Language): A. The number of tags decreases and users can define their own tags…
- Match List I with List IIList I List II A. Oblique Projection I. When the direction of projection is so chosen that the lines perpendicular…