Question: Write a piece of code that declares a stack of integers and uses a loop to fill it with the multiples of 2 from 0
Write a piece of code that declares a stack of integers and uses a loop to fill it with the multiples of 2 from 0 through 100 inclusive, such that 0 is at the top of the stack and 100 is at the bottom: [100, 98, 96, ..., 4, 2, 0]. You can print the stack to verify its state.
Step by Step Solution
3.45 Rating (165 Votes )
There are 3 Steps involved in it
Stack stack new ... View full answer
Get step-by-step solutions from verified subject matter experts
