Knowee
Questions
Features
Study Tools

What will be output of the following pseudo code ?Integer a, b, c Set a=3, b=4,c=10a=10+b if ((a+b+c)<(b+c+a))    a=(3+9)+c    if ((b+a+7)<(5+c+b))        c=(b+11)+c    Else        a=(8+5)+a    End if     b=(2+2)+bElse     if ((b+c)<(c-b))        b=(a+b)+b        c=c+b    End if     a=10+bEnd if print a+b+c

Question

What will be output of the following pseudo code ?Integer a, b, c Set a=3, b=4,c=10a=10+b if ((a+b+c)<(b+c+a))    a=(3+9)+c    if ((b+a+7)<(5+c+b))        c=(b+11)+c    Else        a=(8+5)+a    End if     b=(2+2)+bElse     if ((b+c)<(c-b))        b=(a+b)+b        c=c+b    End if     a=10+bEnd if print a+b+c

🧐 Not the exact question you are looking for?Go ask a question

Solution

The pseudo code provided is a bit confusing due to the lack of proper indentation and formatting. However, I'll try to explain it as best as I can.

First, we initialize three variables a, b, and c with the values 3, 4, and 10 respectively.

Then, we set a to be equal to 10 + b, which is 14.

Next, we have an if statement that checks if (a + b + c) is less than (b + c + a). This condition will always be false because both sides of the inequality are the same (they both add up to the same value). Therefore, the code inside this if statement will not be executed.

Since the condition in the first if statement is false, we move to the else part. Here, we have another if statement that checks if (b + c) is less than (c - b). This condition is also false because (b + c) is greater than (c - b). Therefore, the code inside this if statement will not be executed either.

Finally, we set a to be equal to 10 + b, which is 14.

So, the final values of a, b, and c are 14, 4, and 10 respectively.

Therefore, the output of the pseudo code when we print a + b + c will be 14 + 4 + 10 = 28.

This problem has been solved

Similar Questions

What will be output of the following pseudo code ?Integer a, b, c Set a=3, b=4,c=10a=10+b if ((a+b+c)<(b+c+a))    a=(3+9)+c    if ((b+a+7)<(5+c+b))        c=(b+11)+c    Else        a=(8+5)+a    End if     b=(2+2)+bElse     if ((b+c)<(c-b))        b=(a+b)+b        c=c+b    End if     a=10+bEnd if print a+b+c

what wiil be the output of the following pseudo code?Integer a,b,cSet a=2,b=7, c=9if(9>c || (b&a)<a) c=(b+1)+bElse a=a+c b=5^bEnd ifPrint a+b+c

What will be the output of the following pseudocode?Integer a, b, cset a= 20, b= 5for (each c from b to 7)a = a-1a= a+bend fora= a- bprint a + b

What will be the output of the following pseudocode?Integer a,b,cset a= 0, b= 5, c=12if (3<c)a= 10 & cend ifif ((c - a + b) > (b - c))a= ( a + 6 ) + cc = ( a = a ) & bend ifprint a + b + c[ Note- & bitwise AND - The bitwise AND operator ( & ) compares each bit of the first operand to the corresponding bit of the second operand if both bits are 1 the corresponding result bit is set to 1. otherwise, the corresponding result bit is set to 0 ]

What will be the output of the following pseudo code?1. Inteter a, b, c2. Set a=9, b=4, c=93. if ((b&a)<a)4. a=b&a5. End if6. Pring a+b+c

1/3

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.