Value of x at the Time of Execution

What is the value of x at the time of execution?
int x = 3;
if( x == 2 );
x = 0;
if( x == 3 )
x++;
else x += 2;

Showing Answers 1 - 3 of 3 Answers

Braj Nandan Singh

  • Dec 19th, 2016
 

int x=3; //x=3
if(x==2); //x=3
x=0; //x=0
if(x==3) //x=0
x++; //x=0
else x += 2; //x=2
// Hence x=2

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions