What will be the output of the following pseudocode?
1. Integer x, y, n
2. Set x =e, y = e, n = 6
3. while (x < n)
Print y
5. Set y = y+3
x = x+1
7. end while
Answers
Answered by
7
Explanation:
411
here,
b=a/b;
so the value of b will ne 45.
c=a-b
c=456–45
=411
answer 411
if the statements are like dis.
a/b;
c=a/b
answer is 0
this is your answer please mark me brain list
Answered by
2
Correct question:
What will be the output of the following pseudocode?
1. Integer x, y, n
2. Set x = 4, y = 4, n = 6
3. while (x < n)
4. Print y
5. Set y = y+3
6. x = x+1
7. end while
Answer:
The output of the given pseudocode will be 4, 7.
Explanation:
- The integers x, y, and n are set to 4, 4, and 6.
- The while loop condition checks whether the value of x is less than the value of n.
- In the first iteration, x=4 is less than n=6. So, y=4 is printed.
- The value of y is changed to y+3, i.e., 4+3 = 7, and the value of x is incremented by 1. So, x = 5.
- In the next iteration, x=5 is less than n=6. So, y=7 is printed.
- The value of y is changed to y+3, i.e., 7+3 = 10, and the value of x is incremented by 1. So, x = 6.
- In the next iteration, x=6 is not less than n=6. Hence, the loop is terminated.
Therefore, the output of the given code is 4, 7.
#SPJ3
Similar questions
Social Sciences,
3 months ago
English,
3 months ago
English,
3 months ago
Math,
7 months ago
Computer Science,
11 months ago
Biology,
11 months ago
Physics,
11 months ago