Computer Science, asked by rajarapurachana123, 9 months ago

13) What will be the output of the following pseudo code?
Input m=9,n=6
m=m+1
N=n-1
m=m+n
if (m>n)
print m
else
print n​

Answers

Answered by pruthaasl
0

Answer:

The output of the given pseudo code will be 15.

Explanation:

  • The input variables m and n are initialized to 9 and 6 respectively.
  • In the next line, the value of m is increased by one. So, the value of m becomes 9+1 = 10.
  • The value of n is decreased by one. So, the value of n becomes 6-1 = 5.
  • Now, the value of m is changed to the sum of the values of m and n, i.e., m = m+n = 10+5 = 15.
  • The values of m and n are now 15 and 5 respectively.
  • Next an if-else statement is used which compares the values of m and n.
  • If the value of m is large, the if statement block is executed and the value of m is printed.
  • If the value of n is large, the else statement block is executed and the value of n is printed.
  • Since, m = 15 is greater than n = 5, the value of m, i.e., 15 is printed as the output.

Therefore, the output of the code will be 15.

#SPJ3

Answered by 27swatikumari
0

Answer:

The output of the Pseudo code is 15.

Explanation:

Let's understand the algorithm step by step:

  • The starting values of the input variables m and n are 9 and 6, respectively.
  • The value of m is raised by one in the next line. Consequently, m becomes 9+1 = 10.
  • N's value is reduced by one. N now has a value of 6-1 = 5.
  • M is now equal to the product of the values of m and n, or m = m+n = 10 + 5 = 15.
  • Now, m and n have values of 15 and 5, respectively.
  • The values of m and n are then compared using an if-else expression.
  • The if statement block is executed and the value of m is printed if the value of m is large.
  • The else statement block is executed and the value of n is printed if the value of n is large.
  • The value of m, or 15, is written as the output since it is bigger than n, or 5, which is equal to 5. Consequently, the code's result will be 15.
Similar questions