Please insert the source code into the textbox below before the time up. The code must contain your name and has proper format. Write a program that draws an output by using a character 'X' as examples below. The number of the space between the 'X' is the input number. The program must prompts a user for an integer from 1 to 10 (inclusive). The program must use loop to re-prompt when an invalid input is entered. The invalid input is lower than 1 or larger than 10. The user input will then be used to set the output. Once the program output by using a character 'X', the program is finished. Example 1: Input: 3 Output: XXX XXX XXX Example 2: Input: 4 Output: XXXX хххх хххх хххх Example 3 Input: 0 Please try again! Input: -5 Please try again! Input: 20 Please try again! Input: 5 Output: XXXXX XXXXX XXXXX XXXXX XXXXX
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.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images