Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(e)What is the screen output of the following fragment of C code! int x=20 , y-3

ID: 3722022 • Letter: #

Question

(e)What is the screen output of the following fragment of C code! int x=20 , y-3 , z=5 , w-17 ; printf("x has a value of %d ",w) ; (f)What is the screen output of the following fragment of C code? int i=1; do f i+= 2; printf (''i is while (1C8); %d ",i+2); (g)What is the screen output of the following fragment of C code? int fl (int a, int b, int c)( return (a*b-2*c); int main () f printf ("The result is %d " , f1 (4 , f1 (3 , 2 ,-6) , 8) ) ; return 0; (h)What is the screen output of the following fragment of C code? float number- 5.73810; number= (int) (1000*number) /1000. 0 ; printf("number is %7.2f " , number);

Explanation / Answer

(e) x has a value of 2
(f)
i is 5
i is 7
i is 9
i is 11
(g) The result is 56
(h) number is 5.74

Exp:

(e) w = x / z + z * y - w;
According to BODMAS rule, it will give preference to division, multiplication, addition and subtraction
first, evaluate x / z = 20 / 5 = 4
then, evaluate z * y = 5 * 3 = 15
Finally, 4 + 15 - 17 = 2

(g)Its multiple calls:
first f1(3,2,-6) returns 18
then f1(4, 18, -6) returns 56