If x, y, and z are variables of type int with values4, 7, and 9 respectively, wh
ID: 3613348 • Letter: I
Question
If x, y, and z are variables of type int with values4, 7, and 9 respectively, what is output by the following sequenceof printf() calls? (Note: pleasewrite this C program in UNIX) printf( "%d, %d, %d ", x + 2%x, ++z %x, y++ /x ); printf( "%d, %d, %d ", x + y + z++, 3*y/2, 3/2*y ); printf( "%d, %d, %d ", ++y + ++z, x - 4, 2 * x % 3 ); If x, y, and z are variables of type int with values4, 7, and 9 respectively, what is output by the following sequenceof printf() calls? (Note: pleasewrite this C program in UNIX) printf( "%d, %d, %d ", x + 2%x, ++z %x, y++ /x ); printf( "%d, %d, %d ", x + y + z++, 3*y/2, 3/2*y ); printf( "%d, %d, %d ", ++y + ++z, x - 4, 2 * x % 3 ); printf( "%d, %d, %d ", x + 2%x, ++z %x, y++ /x ); printf( "%d, %d, %d ", x + y + z++, 3*y/2, 3/2*y ); printf( "%d, %d, %d ", ++y + ++z, x - 4, 2 * x % 3 );Explanation / Answer
If x, y, and z are variables of type int with values4, 7, and 9 respectively, what is output by the following sequenceof printf() calls? (Note: pleasewrite this C program in UNIX) printf( "%d, %d, %d ", x + 2%x, ++z %x, y++ /x );2%4=2, 4+2=6 9+1=1010%4 = 2 7/4=1
at this point x=4, y=8, z=10
printf( "%d, %d, %d ", x + y + z++, 3*y/2, 3/2*y );
4+8+10=22 3*8=2424/2=12 3/2=11*8=8
at this point x=4, y=8,z=11
printf( "%d, %d, %d ", ++y + ++z, x - 4, 2 * x % 3 );
9+12=21 4-4=0 2*4=8 8%3= 2
at this point x=4, y=9,z=12
The output
printf( "%d, %d, %d ", x + 2%x, ++z %x, y++ /x );
2%4=2, 4+2=6 9+1=1010%4 = 2 7/4=1
at this point x=4, y=8, z=10
printf( "%d, %d, %d ", x + y + z++, 3*y/2, 3/2*y );
4+8+10=22 3*8=2424/2=12 3/2=11*8=8
at this point x=4, y=8,z=11
printf( "%d, %d, %d ", ++y + ++z, x - 4, 2 * x % 3 );
9+12=21 4-4=0 2*4=8 8%3= 2
at this point x=4, y=9,z=12
The output
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.