Inrhythm
Company
Programming
Technical
main()
{
int a=10;
printf ("%d%d%d",a,a++,++a);
}
output of this program
Read Solution (Total 25)
-
- ans: 12 11 11
- 10 years agoHelpfull: Yes(12) No(4)
- a=10
a++(use then increment)---- a=10,display then increment i.e a=11
++a(increment then use)---- a=11,increment => a=12 then display
so,output is
101012 - 9 years agoHelpfull: Yes(6) No(5)
- ans:10 10 12
- 10 years agoHelpfull: Yes(4) No(2)
- In printf it starts its execution from right to left .so first it performs ++a ,so it becomes 11.next it performs a++ so its value becomes 11 .and then a value becomes 12.so the correct answer is 12 11 11.
- 9 years agoHelpfull: Yes(4) No(0)
- 10 as for a,
10 as for a++ since first value is assigned then incremented
11 as for ++a since first value is incremented then assingned - 10 years agoHelpfull: Yes(3) No(0)
- ans is 10 10 11
- 9 years agoHelpfull: Yes(3) No(1)
- ans 12 11 12
- 9 years agoHelpfull: Yes(3) No(0)
- The output will be 12 11 11
- 10 years agoHelpfull: Yes(2) No(0)
- output is
12 12 10 - 9 years agoHelpfull: Yes(2) No(0)
- 12 11 11
because it will read from right side - 9 years agoHelpfull: Yes(2) No(0)
- 12 11 11 because execution starts from right side
- 9 years agoHelpfull: Yes(2) No(0)
- the output of the program is 10, 11, 10.
- 9 years agoHelpfull: Yes(1) No(3)
- 10,11,10
bcoz a=10,a++=10+1 i.e 11 and ++a=10 - 9 years agoHelpfull: Yes(1) No(3)
- 10, 10, 12
- 9 years agoHelpfull: Yes(1) No(1)
- 10,10,12 is the output
- 9 years agoHelpfull: Yes(1) No(1)
- calculating starts from right to left so ans is 12 12 10
- 9 years agoHelpfull: Yes(1) No(1)
- Ans is 10 10 11
a++ is post increment
++a is pre increment
Post increment will be executed in next line but not for same line.
Pre increment will be executed there it self - 9 years agoHelpfull: Yes(1) No(1)
- a=10
a++=10
++a=12 - 7 years agoHelpfull: Yes(1) No(0)
- 12 11 12....
the order of evalutaion is 1st post increment (a++), 2nd pre increment(++a) and then the normal variables(a). so 1st a++ is executed (10+1=11), then ++a(11+1=12) and at last (a=12)..hence 12 11 12(gets printed in order) - 7 years agoHelpfull: Yes(1) No(0)
- ans: 12,11,11 . As the evaluation order in printf goes from right to left.
- 7 years agoHelpfull: Yes(1) No(0)
- Answer : 12 11 11
- 6 years agoHelpfull: Yes(1) No(0)
- ans:10 11 12
- 10 years agoHelpfull: Yes(0) No(1)
- a=10,a++=11,++a=9.
- 9 years agoHelpfull: Yes(0) No(1)
- a = 10
a++ = 10++ = 10 (post increment---increment later)
//now a is incremented to 11
++a = ++11 = 12 (pre increment) - 9 years agoHelpfull: Yes(0) No(1)
- a=10
a++=10(since it first prints the 10 value and then increments its value to 11)
++a=12(as its increments and get stored in the a variable) - 6 years agoHelpfull: Yes(0) No(0)
Inrhythm Other Question