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

Consider the following fragment. The for each part, state thevalue of the result

ID: 3612848 • Letter: C

Question

Consider the following fragment. The for each part, state thevalue of the result variable. int num = 5, num2 = 23, result_i = 0; float num3 = 6.0, num4 = 32.0, result_f = 0.0 a) result_i =num2/num1;           is that gonna be 23 divided by 5? b) result_f =num2/(float)num1;      and 23 dividedby 6.0? c) result_i = num1 %num2 ;          Loston c,d d) result_i = (int)num4% (int)num3; e) result_f =num4/num3;                   divide0.0 by 6.0? Consider the following fragment. The for each part, state thevalue of the result variable. int num = 5, num2 = 23, result_i = 0; float num3 = 6.0, num4 = 32.0, result_f = 0.0 a) result_i =num2/num1;           is that gonna be 23 divided by 5? b) result_f =num2/(float)num1;      and 23 dividedby 6.0? c) result_i = num1 %num2 ;          Loston c,d d) result_i = (int)num4% (int)num3; e) result_f =num4/num3;                   divide0.0 by 6.0? a) result_i =num2/num1;           is that gonna be 23 divided by 5? b) result_f =num2/(float)num1;      and 23 dividedby 6.0? c) result_i = num1 %num2 ;          Loston c,d d) result_i = (int)num4% (int)num3; e) result_f =num4/num3;                   divide0.0 by 6.0?

Explanation / Answer

int num = 5, num2 = 23, result_i =0;               assuming this should be int num1=5, float num3 = 6.0, num4 = 32.0, result_f = 0.0 a) result_i =num2/num1;           is that gonna be 23 divided by 5?     int/int=int answer will truncate result_i=4 b) result_f =num2/(float)num1;      and 23 dividedby6.0?              int/float=float     result_f=3.83 c) result_i = num1 %num2 ;          Lostonc,d                             % is remainder      5/23 remainder is5   result_i=5 d) result_i = (int)num4%(int)num3;                                           32/6 answer is 5 remainder2       result_i=2 e) result_f =num4/num3;                   divide0.0 by6.0?              float/float=float    32.0/6.0       result_f=5.33 a) result_i =num2/num1;           is that gonna be 23 divided by 5?     int/int=int answer will truncate result_i=4 b) result_f =num2/(float)num1;      and 23 dividedby6.0?              int/float=float     result_f=3.83 c) result_i = num1 %num2 ;          Lostonc,d                             % is remainder      5/23 remainder is5   result_i=5 d) result_i = (int)num4%(int)num3;                                           32/6 answer is 5 remainder2       result_i=2 e) result_f =num4/num3;                   divide0.0 by6.0?              float/float=float    32.0/6.0       result_f=5.33
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote