tag:blogger.com,1999:blog-9193160645817040317.post9049401337809281211..comments2015-12-22T12:31:53.234+05:30Comments on Twisters - The New Age Java Quiz: Puzzle 17 – YAAP (Yet Another Arithmetic Puzzle)Saifuddin Merchanthttp://www.blogger.com/profile/09008041357659535766noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-9193160645817040317.post-85214371714167488782009-04-22T13:04:00.000+05:302009-04-22T13:04:00.000+05:30Value of i : 7
Value of j : 11Value of i : 7<br />Value of j : 11danhttps://www.blogger.com/profile/07001012765091112712noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-39927442477584098942009-04-20T14:48:00.000+05:302009-04-20T14:48:00.000+05:30i=7,
1.i=5
2.i++,so i=6
3.i++,so i=7
j=11
j=i++ +...i=7,<br />1.i=5<br />2.i++,so i=6<br />3.i++,so i=7<br /><br />j=11<br />j=i++ + i++;<br />means<br />j=5+6;<br />j=(initial i)+((i+1))<br />then i becomes (i+1)+1kannanhttps://www.blogger.com/profile/03791870748411766033noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-15060855821435231622009-04-20T14:03:00.000+05:302009-04-20T14:03:00.000+05:30i=12,j=11i=12,j=11Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-28287741368292523262009-04-20T03:06:00.000+05:302009-04-20T03:06:00.000+05:30I think....
Line 6 would evaluate as j = 5 + 5;
T...I think....<br /><br />Line 6 would evaluate as j = 5 + 5;<br />Therefore, in the end i = 7, j = 10.<br /><br />If you wanted the final value of j to be 13 you would have to rewrite line 6 as:<br /><br /> j = ++i + ++i;<br /><br />The latter forces the increment operation to happen before the assignment.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-73437931041823446962009-04-19T23:23:00.000+05:302009-04-19T23:23:00.000+05:30Was'nt that simple,
i=7 and j=11Was'nt that simple, <br />i=7 and j=11Minochahttps://www.blogger.com/profile/12283732812538968111noreply@blogger.comtag:blogger.com,1999:blog-9193160645817040317.post-32027334635056886952009-04-19T20:14:00.000+05:302009-04-19T20:14:00.000+05:30It is easy :)
The outputs are:
Value of i : 7
Val...It is easy :)<br />The outputs are:<br /><br />Value of i : 7<br />Value of j : 11<br /><br />Thanks my friend.<br />your friend: "Turki.27" :)Turkihttps://www.blogger.com/profile/15189640422306146961noreply@blogger.com