Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2A. Consider an elevator with a maximum capacity of 10 people. People can always leave the elevator anytime. However, people cannot enter the elevator
2A. Consider an elevator with a maximum capacity of 10 people. People can always leave the elevator anytime. However, people cannot enter the elevator if the total number of people (including those who are already in the elevator) exceeds the maximum of 10. Write a C program using a switch statement to perform the following operations: 1. 2. Add people: Reads the number of persons who want to enter the elevator. Allow them if the maximum capacity is not exceeded. Partial addition of persons into the elevator is not allowed. Display the total number of people in the elevator after adding them. Remove people: Removes people from the elevator. Display the total number of people in the elevator after removing them. Continuously display the above options until the user enters -1 to stop. 2B. Develop a C program to find the maximum distance between two neighboring a's in the input string using for loop. abcbc adghacbd mnbaba neighbouring a's with maximum distance max_distance value = 7 Page 1 of 3 2C. Illustrate the working of binary search to find 33 in the given set of numbers 6, 13, 14, 25, 33, 43, 51, 53, 64, 72, 84, 93, 95, 96, 97. Show all intermediate computations.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started