ayesha rosheen
24. What will be the output of the following pseudocode? Integer a, b Set a = 15, b = 7 a = a mod (a - 3) b = b
mod (b - 3) a = a mod 1 b = b mod 1 Print a + b
15
7
0
2
Next >
Answers
Answered by
3
Answer:
0
Explanation:
0 Will be Answer For Above Question
Answered by
6
Given:
Integer a, b
Set a = 15, b = 7
a = a mod (a - 3)
b = b mod (b - 3)
a = a mod 1
b = b mod 1
Print a + b
Output:
0
Explanation:
mod gives remainder
a = 15
b = 7
a = a mod (a - 3) = 15 mod (15 - 3) = 15 mod 12 = 3
b = b mod (b - 3) = 7 mod (7 - 3) = 7 mod 4 = 3
a = a mod 1 = 3 mod 1 = 0
b = b mod 1 = 3 mod 1 = 0
a + b = 0 + 0 = 0
Print a+b = 0
Similar questions