Thank u aditi now I got it........since i m considering z=+x<y is one common term ,silly mistake.......Thank u very much..
On Wed, Jul 27, 2011 at 10:18 PM, aditi garg <[email protected]>wrote: > C i guess ur comfortable wid the frst 3... > now in fourth c the order of evaluation frst x<y is evaluated as < has > higher precedence that +=...since both r 3...so condition is false and y++ > is taken...so z+=y++ takes place... > z ws 1 and y=3...so z becomes 4 and it is printed... and after this y > becomes 4... and since x++ ws not evaluated it retains its value of 3... > in the next one z>=y takes place frst( associativity of >= is left to > right) ,since it is true it become 1 now 1>=x is false hence ans 0... > in the last both z>=y and y>=x are true hence 1 > i hope it is clear... > > > hence the ans 3 4 4 fr the next printf > > On Wed, Jul 27, 2011 at 9:33 PM, Vijay Khandar <[email protected]>wrote: > >> #include<stdio.h> >> #include<conio.h> >> void main() >> { >> clrscr(); >> int x=1,y=1,z=1; >> x+=y+=z; >> printf("\n %d\n ",x<y?y:x); >> printf("\n %d\n",x<y?x++:y++); >> printf("\n %d %d\n",x,y); >> printf("\n %d\n",z+=x<y?x++:y++); >> printf("\n %d %d %d\n",x,y,z); >> x=3;y=z=4; >> printf("\n %d\n",z>=y>=x?1:0); >> printf("\n %d\n",z>=y&&y>=x); >> getch(); >> } >> >> I m getting o/p as-- >> 3 >> 2 >> 3 3 >> 4 >> 3 4 4 >> 0 >> 1 >> >> I m confusing fm fourth printf...plz explain me.......... >> >> Vijay............. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > Aditi Garg > Undergraduate Student > Electronics & Communication Divison > NETAJI SUBHAS INSTITUTE OF TECHNOLOGY > Sector 3, Dwarka > New Delhi > > 9718388816 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
