Main(){int x=20;int y=35;x=y++ +x++;printf("%d",x);}

Showing Answers 1 - 32 of 32 Answers

murali

  • Nov 5th, 2006
 

answere is 56.35+20=55 at last x is incremented so ans is 56

  Was this answer useful?  Yes

Jitendra

  • Nov 6th, 2006
 

Hi all,If you try to execute the program on windows environment then output will be 56.But have ever tried it on UNIX environment???Their the output will be 11.If any concern..let me know....

  Was this answer useful?  Yes

chris

  • Nov 8th, 2006
 

Answer:

1.y is assigned ti x.

2.x is inc by1. x=36.

3.this x value(36) add with x++ value(20+1).

4.so x=57.

  Was this answer useful?  Yes

Anurag

  • Nov 9th, 2006
 

Simply ans is 56; x=y++ +x++; This statement means that x & y are to be added & then increment is donei.e. x+y=55 and then y++ and x++ will be done ,thus y becomes 36 and x becomes 56 from 55.

  Was this answer useful?  Yes

aloksingh

  • Nov 19th, 2006
 

x will 56 bcz

according to rule first expression will solve i mean--

 y++=36 and then x=20 we will leave ++operator for assign ment in x.

ans is x=56

  Was this answer useful?  Yes

raghava

  • Nov 23rd, 2006
 

yes u r answer is correct

  Was this answer useful?  Yes

AMIT

  • Nov 25th, 2006
 

The output Will be x=56

bsc here post incremental operator is used.

  Was this answer useful?  Yes

Sundar A

  • Nov 29th, 2006
 

The result is suppose to be undefined, i.e the compiler can handle it whatever way it wish to. This code is an invalid code just like "a[i] = i++"

  Was this answer useful?  Yes

Ghost

  • Dec 18th, 2006
 

try to execute on Unix Machine..You will get 21

  Was this answer useful?  Yes

aditya

  • Dec 26th, 2006
 

at first y&x are added together n da ans. is 55.....i.e x=55.....

but later on X & Y are both incremented by one ,so now x=56....

 

  Was this answer useful?  Yes

kcv

  • Jan 21st, 2007
 

If we read the C Standards it will clearly state not to write statements like this x = y++ + x++. So such questions are a waste of time. Surely no manager would like someone to code like this. Code should be be as clear as possible with jst one meaning.

  Was this answer useful?  Yes

prashant kara

  • Jan 24th, 2007
 

here, x = 20; & y = 35; given, x= y++ + x++; so in this case, first we put the value of variables, x = 35+ 20 = 55 but here, x is increament so,we have to find the value of x, therefore, x++= 20+1=21, so, x = 35+21 = 56 . so the answer is 56.its correct..

  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