What is a looping statement? What are the different looping statements supported by
QBASIC program?
Answers
Answer:
A loop decides how many times to execute another statement. There are three kinds of loops: while loops test whether a condition is true before executing the controlled statement. do-while loops test whether a condition is true after executing the controlled statement.
I think it will help you
Answer:
In computer science, a for-loop (or simply for loop) is a control flow statement for specifying iteration, which allows code to be executed repeatedly. Various keywords are used to specify this statement: descendants of ALGOL use "for", while descendants of Fortran use "do". There are other possibilities, for example COBOL which uses "PERFORM VARYING".
for-loop has two parts: a header specifying the iteration, and a body which is executed once per iteration. The header often declares an explicit loop counter or loop variable, which allows the body to know which iteration is being executed. For-loops are typically used when the number of iterations is known before entering the loop. For-loops can be thought of as shorthands for while-loops which increment and test a loop variable.
The name for-loop comes from the English word for, which is used as the keyword in many programming languages to introduce a for-loop. The term in English dates to ALGOL 58 and was popularized in the influential later ALGOL 60; it is the direct translation of the earlier German für, used in Superplan (1949–1951) by Heinz Rutishauser, who also was involved in defining ALGOL 58 and ALGOL 60. The loop body is executed "for" the given values of the loop variable, though this is more explicit in the ALGOL version of the statement, in which a list of possible values and/or increments can be specified.
Different looping statements are
1. In FORTRAN and PL/I, the keyword DO is used for the same thing and it is called a do-loop; this is different from a do-while loop.
2. The PRINT statement is used to display numbers, messages or values of variables on the output screen.
3. The REM statement is used to write a remark or a comment in the program that does not get
The CLS statement is used to clear the output screen.
4.The LET statement is used to assign a value to a variable.
5.The INPUT statement is used to take a value from the user and store it in a variable.
6.The IF…THEN…ELSE is a conditional statement that executes a set of statements depending upon a condition.