1
GATE AI 2025
Numerical
+2
-0

Consider the following pseudocode.

Create empty stack S

set $x=0$, flag $=0$, sum $=0$

Push $x$ onto $S$

while ( $S$ is not empty) $\{$

if (flag equals 0){

Set $x=x+1$

Push $x$ onto S}

if ( $x$ equals 8 ):

Set flag $=1$

if (flag equals 1){

$x=\operatorname{Pop}(\mathrm{S})$

if ( $x$ is odd):

Pop (S)

Set sum $=\operatorname{sum}+\mathrm{x}\}$

}

Output sum

The value of sum output by a program executing the above pseudocode is________

Your input ____