ELEVATOR In this program , I've made a program to demonstrate the working of an elevator. This uses if-else statements and while loop for decision making , and on the basis of that it decides on where to move. I've written this purely in C language. I've used various standard libraries and lots of if-else statements, inside the while loop. This contains a decision making statement to even exit the elevator program and if that is not executed the elevator stays in working state.
(https://github.com/user-attachments/assets/8d45c000-a31d-4d69-9107-b7b0e167de8b)
TAKING THE INPUT For taking the input we are using another while loop to check the initial condition. We have created two variables for floor input, one of them is initialand the other one is floor. Initial is the variable which is 0 initially as it is on ground floor, and it gets updated everytime it reaches target floor. Floor takes the input for the floor user wants to get to, and this program shows it moving by displaying every floor on the way to tgarget floor . I've used sleep(1) to create a delay of 1second between the floors to show the movement.