retagged by
842 views
1 votes
1 votes

Suppose a stack $S$. Which is empty initially consider the following code:

int values[] = {1, 3, 5, 7, 9, 11, 13, 15, 17, 19};
for(int i=0; i<10; i++)
{
   S.PUSH = (values[i]);
}
int n = 25;
for (int i=0; i<4; i++)
{
    n+= S.POP();
}
for(int i=0; i<2; i++)
{
    n-= S.POP();
}
printf("%d",n);

The output of the program code is _________ .

retagged by

3 Answers

0 votes
0 votes
the answer is 69.  As the value of n=25+19+17+15+13-11-9

Related questions

3 votes
3 votes
2 answers
1
Kalpataru Bose asked Jul 29, 2018
646 views
Which of the following permutations can be obtained in the same order using a stack assuming that input is the sequence 5,6,7,8,9 in that order?A ) 7,8,9,5,6B ) 5,9,6,7,8...
2 votes
2 votes
0 answers
2
Akash Mishra asked Jul 26, 2017
970 views
The correct answer to the following question is 24. Please explain.
0 votes
0 votes
1 answer
3
Souvik33 asked Nov 2, 2022
864 views
Which data structure would be most appropriate to implement a collection of values with the following 3 characteristicsSingly link list with head and tail pointerDoubly l...
0 votes
0 votes
0 answers
4
none30 asked Jun 11, 2023
439 views
What is the smallest and largest number of entries for 2-3 BTree (B2-3 Tree) of height 8 (i.e., 8 levels) ?255 and 6560127 and 2186 6561 and 255255 and 2186