plz solve.this questions
Attachments:
Arshiya6:
is it a java code???
Answers
Answered by
1
1ST STEP:
Always execution starts from main.
Given int A = 50, B = 20 and execute(B) i.e 20.
That means the value of B is passed to x i.e 20.
TEMP = 20 + 200 = 220;
x+=220;
x = x+220;
= 20 + 220
= 240.
if(Y!=200) ----------- This condition is false.That means it comes out of loop.
cout<<A<<B = 50,240.
2ND STEP:
EXECUTE(A, B) = EXECUTE(50,240) (from step (1)).
That means 50 is passed to X and 240 is passed to Y.
TEMP = 50 + 240 = 290.
X+ = TEMP;
X+ = 290;
X=X+290
= 50 + 290
= 340.
if(Y!=200) ---- This condition is true because y value is 240 not 200.
cout<<TEMP<<X<<Y<<end1 value is 290,340,240.
3RD STEP :
The values are passed to cout<<A<<B<<endl; i.e 340,240.(from step(ii)).
The output of the following program is:
50 240
290 340 240
340 240.
Hope this helps!
Always execution starts from main.
Given int A = 50, B = 20 and execute(B) i.e 20.
That means the value of B is passed to x i.e 20.
TEMP = 20 + 200 = 220;
x+=220;
x = x+220;
= 20 + 220
= 240.
if(Y!=200) ----------- This condition is false.That means it comes out of loop.
cout<<A<<B = 50,240.
2ND STEP:
EXECUTE(A, B) = EXECUTE(50,240) (from step (1)).
That means 50 is passed to X and 240 is passed to Y.
TEMP = 50 + 240 = 290.
X+ = TEMP;
X+ = 290;
X=X+290
= 50 + 290
= 340.
if(Y!=200) ---- This condition is true because y value is 240 not 200.
cout<<TEMP<<X<<Y<<end1 value is 290,340,240.
3RD STEP :
The values are passed to cout<<A<<B<<endl; i.e 340,240.(from step(ii)).
The output of the following program is:
50 240
290 340 240
340 240.
Hope this helps!
Similar questions