* *
*
* * News
 • Daily news
 • Archived news

Columns
 • WildCard
 • Qbasic Articles
 • QB Comic!

Learning center
 • QB Books
 • Qbasic Lessons!
 • Qbasic FAQ
 • Newbies Section
 • Qbasic Tutorials

* *
*
*
*
*  
.INPUT Statement Programming Example.

  QuickSCREEN      Details     Example      Contents      Index
ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
INPUT Statement Programming Example
This example uses INPUT to calculate the area of a circle from a
radius you supply. It prompts you for a new radius until you enter 0.
 
CLS
PI = 3.141593 : R = -1
DO WHILE R
    PRINT "Enter radius (or 0 to quit)."
    INPUT ; "If radius = ", R
    IF R > 0 THEN
        A = PI * R ^ 2
        PRINT ", the area of the circle ="; A
    END IF
    PRINT
LOOP
 
Sample Output
 
Enter radius (or 0 to quit).
If radius = 3, the area of the circle = 28.27434
 
Enter radius (or 0 to quit).
If radius = 4, the area of the circle = 50.26549
 
Enter radius (or 0 to quit).
If radius = 0
 
* * ** * * * *