An infinite loop is one which keeps on running for all values of loop variables involved. Essentially, the reason for an infinite loop is that the condition for the loop is always true.
Example: Write a program using ‘*’ showing infinite loop.
The word written after goto is called a label. The label can be any word and it is not to be declared or initialized first like a variable. The difference between a break statement and goto statement is that , when the loop ends using a break statement the program execution continues after the for loop for the goto statement the program execution will start from the label to which the goto statement is directed.
Example: Write a program showing ‘*’ using goto statement.
Switch statement is similar to an if-else structure studied earlier. In switch statement, the option selected by user is compared against all the available cases and the appropriate case is executed. The basic syntax of switch statement is
Example:Write a program to determine that student is pass or fail.
Example:Write a program to choose the arithmetic operation.