What will be the output of the following Pseudocode?1.input m=9,n=62.m=m+13.n=n-14.m=m+n5.if(m>n)6. print m7.else8. print n106515
Question
What will be the output of the following Pseudocode?1.input m=9,n=62.m=m+13.n=n-14.m=m+n5.if(m>n)6. print m7.else8. print n106515
Solution
Let's go through the pseudocode step by step:
- We are given m=9 and n=6.
- We add 1 to m, so m becomes 9+1=10.
- We subtract 1 from n, so n becomes 6-1=5.
- We add m and n, so m becomes 10+5=15.
- We check if m is greater than n. Since 15 is greater than 5, we print m.
So, the output of the pseudocode will be 15.
Similar Questions
What will be the output of Pseudocode?Integer n, rev, rem, origSet n = 61206, rev = 0Set orig = nWhile n NOT EQUALS 0 rem = n MOD 10 rev = rev * 10 + rem n = n / 10End whileIf (orig IS EQUAL TO rev) Print revElse Print (orig – rev) / 6End If
What will be the output of the following pseudocode?1. input f=6, g=9 and set sum=02. integer n3. if ( g>f)4. for (n=f ; n<g ; n=n+1)5. sum = sum+n6. end for loop7. else8. print error message 9. print sum921156
What will be the output of the following Pseudocode?. int a=10, b=4, i. if (a+b>14). print a. else . for(i=1 to 3 ). a = a+i. end for loop. print a4101614
What will be the output of the following pseudocode?Integer p, q, rset p= 1, q= 1, r= 2q = p - 1q = r - 1if (p + 2 > q -6)if (q+2 > p- 6)p = 2end ifq= 2if (r> 5)p = qend ifend ifprintf p + q + r
What will be the output of the following pseudo code?1. Integer p, q, r2. Set p=7, q=6, r=83. if((p^9^8) > (p^5))4. p = (12+4) +r5. End if6. Print p+q+r
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.