X is an integer (x=1234). the print value y of the algorithm below is(note % is the modulo operator , which calculas the remainder and / gives the quadient of the division operator.
Answers
Answered by
6
Answer:
9
Explanation:
x%10 = 1234%10 = 4
y= 0 + 4 = 4gain
x/10 = 1234/10 = 123 (since x is an interger, it ignores the float value.)
now,
x%10 = 123%10 = 3
y = 4 +3 = 7
x/10= 123/10 = 12
again,
x%10 =12 %10 = 2
y = 7 + 2 = 9
x/10 = 12/10 = 1
x%10 = 1%10=0(because x only takes integer value.)
y = 9+0 = 9
x/10 = 1/10 = 0
therefore y=9.
Similar questions