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

what is the output?

Answers were Sorted based on User's Feedback



main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / fazlur rahaman naik

x = 57 and y = 94.

because the value of x = y++ + x++(35 + 20) is 55 and then
it incremented here x++ i.e.56 and the value of y = 36 and
then the value of y = ++y + ++x(57 + 37) = 94.

Is This Answer Correct ?    37 Yes 8 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / s.srinivasulu

Answer:
x=57
y=94

Is This Answer Correct ?    14 Yes 6 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / manishsoni

here first in
x = y++ + x++;
x=35+20;
x=55;

then x is incresed by 1;
x=56;
y=36

y=++y + ++x;
y=++36 + ++56;
y=37+57;

y=94;
x=57;
now the value of x = 57.
therefore,after performing all operatioins we get,
x==57 And y==94....

Is This Answer Correct ?    6 Yes 1 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / sagar

here first in x = y++ + x++;
= (35+1) + (20+1);//here value of x is not
= 36 + 21; assigned to 21 as x++
= 57... and 'lly to y++....
now the value of x = 57.
now for y = ++y + ++x;
= (1+35) + (1+57);
= 36 + 58;
= 94...
therefore,after performing all operatioins we get,
x==57 And y==94....

Is This Answer Correct ?    6 Yes 4 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / mahendra gupta

x=57
y=94

Is This Answer Correct ?    4 Yes 3 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / krzysztof

People... is itt really so hard to compile that and check? Correct answer, compiled with gcc:
56 93

Is This Answer Correct ?    0 Yes 1 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / yusuf

x++ means we have to assign the value and then the
increment comes to light.......so
x=y++ + x++;
=35 + 20;
=55

now the value of x=55 then
y=37 + 56;
=93

Is This Answer Correct ?    2 Yes 5 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / c

x=y++ + x++;

here we should assign the value and then the increment
the value and the new value should be stored in a specified
variable....
here it is......
X= 35 (value=36 is stored in y) + 20 ( value=21
is stored in x);
X=55
NOw the value of x=55..and Y=36..the next expression
changes to like this...

Y= 37+56=93

Is This Answer Correct ?    1 Yes 4 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / vignesh1988i

x=57
y=95

Is This Answer Correct ?    9 Yes 14 No

main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }..

Answer / mastan vali.shaik

55 59

Is This Answer Correct ?    3 Yes 23 No

Post New Answer

More C Interview Questions

what is difference between getchar,putchar functions and printf and scanf function? does putchar show output only when input given to it

5 Answers   DIT,


find a number whether it is even or odd without using any control structures and relational operators?

22 Answers   Microsoft, Shashank Private Limited,


main() { int i=0; while(+(+i--)!=0) i-=i++; printf("%d",i); }

4 Answers  


Explain about block scope in c?

0 Answers  


#define PRINT(int) printf("int = %d ",int) main() {< BR> intx,y,z; x=03;y=02;z=01; PRINT(x^x); z<<=3;PRINT(x); y>>=3;PRINT(y); }

0 Answers   Wilco,






Symmetric technologies interview questions. For Computer science candidates the first round is a objective type written test consisting of 16 questions.It is very easy ,any police man can solve this. And next round is a written test consists of both objective and subjective .Total 40 question related to c,c++ and operating system related questions. And then a technical interview and give some program to solve with computer.The md is adamant person, whatever he says we have to accept that is the condition. And one more thing ,,,these interview is just for a formality..the company will select only innocent guys.. the person's without a backbone only they require.. And u have to submit the certificates this is the most important problem...So if you are not getting any other jobs..then only join with this... It is better to try for other company...And apart from that symmetric do a lot of projects..If a candidate can manage everything u can join and make good career with this company... The Md will normally speak rudely..but he is good person and he will give you a lot of very good chances to improve your career....but with cheap salary....

0 Answers   Symmetric Technologies,


out put of printf(ā€œ%dā€,printf(ram));

5 Answers  


i want the code for printing the output as follows 4 4 3 3 2 2 1 1 0 1 1 2 2 3 3 4 4

2 Answers  


What is non linear data structure in c?

0 Answers  


int a[3][5]={ {1,2,3,4,5],{2,3,4,5,6},{10,11,12,13,14}}; int *p=&a; printf(ā€œ%dā€,*(*(x+1)+3));

2 Answers   Wipro,


Explain what is the difference between far and near ?

0 Answers  


Is python a c language?

0 Answers  


Categories