ALGORITHM: Step 1: Initialize the integer variables. Step 2: In a switch case, in case 1 the number to be pushed is got Step 3:Top is now equal to top+1 Step 4: Else the stack is full Step 5: In case...


in language c


Perform all stacks operation


ALGORITHM:<br>Step 1: Initialize the integer variables.<br>Step 2: In a switch case, in case 1 the number to be pushed is got<br>Step 3:Top is now equal to top+1<br>Step 4: Else the stack is full<br>Step 5: In case 2 the number to be deleted is got<br>Step 6: Top is now equal to top-1<br>Step 7: Else the stack is empty<br>Step 8: In case 3 if the top is less than 0 the stack is ful<br>Step 9: Else the stack is printed<br>Step 10: Default is no such choice<br>INPUT / OUTPUT<br>Enter the operation to be performed: 1) push 2) pop 3) display 4) exit<br>1<br>Enter the number to be Added: 11<br>Enter the operation to be performed: 1) push 2) pop 3) display 4) exit<br>1<br>Enter the number to be Added: 22<br>Enter the operation to be performed: 1) push 2) pop 3) display 4) exit<br>1<br>Enter the number to be Added: 33<br>Enter the operation to be performed: 1) push 2) pop 3) display 4) exit<br>1<br>Enter the number to be Added: 44<br>Enter the operation to be performed: 1) push 2) pop 3) display 4) exit<br>2<br>Enter the number to be Added: 44<br>Enter the operation to be performed: 1) push 2) pop 3) display 4) exit<br>3<br>The stack is 11 22 33<br>Enter the operation to be performed: 1) push 2) pop 3) display 4) exit<br>4<br>RESULT:<br>All the stack operations are performed using the switch case<br>

Extracted text: ALGORITHM: Step 1: Initialize the integer variables. Step 2: In a switch case, in case 1 the number to be pushed is got Step 3:Top is now equal to top+1 Step 4: Else the stack is full Step 5: In case 2 the number to be deleted is got Step 6: Top is now equal to top-1 Step 7: Else the stack is empty Step 8: In case 3 if the top is less than 0 the stack is ful Step 9: Else the stack is printed Step 10: Default is no such choice INPUT / OUTPUT Enter the operation to be performed: 1) push 2) pop 3) display 4) exit 1 Enter the number to be Added: 11 Enter the operation to be performed: 1) push 2) pop 3) display 4) exit 1 Enter the number to be Added: 22 Enter the operation to be performed: 1) push 2) pop 3) display 4) exit 1 Enter the number to be Added: 33 Enter the operation to be performed: 1) push 2) pop 3) display 4) exit 1 Enter the number to be Added: 44 Enter the operation to be performed: 1) push 2) pop 3) display 4) exit 2 Enter the number to be Added: 44 Enter the operation to be performed: 1) push 2) pop 3) display 4) exit 3 The stack is 11 22 33 Enter the operation to be performed: 1) push 2) pop 3) display 4) exit 4 RESULT: All the stack operations are performed using the switch case

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here