What would be the output of the following ?
1. Integer x, y
2. set x = 6789, y = 1
3. while(x not equals 0)
4. x = x / 10
5. x = x * y + x
6. x = x mod 10
7. y = y + 1
8. print x + y
9. end while
Ops: A. 4 B. 1 C. 03. D. 2
Answers
Answered by
2
Answer:
6790
Step-by-step explanation:
x = 6789, y = 1
then x + y
6789+1
6790
Answered by
1
Answer: C. 03
1st loop:
x=678
x=6789+678=7467
x=7467 mod 10=7
y=2
output 9
2nd loop:
x=7/10=0
x=0
x=0 mod 10=0
y=2+1=3
output=3
Loop ends
Answer = 3
Similar questions