1) Request an integer input for the variable, n. 2) Write a if-elif-else statement to determine a team classification: a) if the n is less than 0, print an error message, Invalid input. b) if the n is at least 0 but less than 100, print a message, Join the Red team! c) if the n is at least 100 but less than 200, print a message, Join the Blue team! d) if the n is at least 200 but less than 300, print a message, Join the Green team! e) if the n is equal to 300, print a message, You can join any team! f) if the n is more than 300, print a message, You can join the waiting list
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
1) Request an integer input for the variable, n.
2) Write a if-elif-else statement to determine a team classification:
a) if the n is less than 0, print an error message, Invalid input.
b) if the n is at least 0 but less than 100, print a message, Join the Red team!
c) if the n is at least 100 but less than 200, print a message, Join the Blue team!
d) if the n is at least 200 but less than 300, print a message, Join the Green team!
e) if the n is equal to 300, print a message, You can join any team!
f) if the n is more than 300, print a message, You can join the waiting list.
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)