The STOP and END statements

The STOP and END statements

    The form of STOP statement is
    The_STOP_and_END_statements.jpg
    eg :
    500 STOP
    When this statement is encountered in a program, the execution of the program stops. There may be more than one STOP statement or none at all in a program. It may be placed in the program wherever necessary. STOP is also known as logical end of the program.
    The end of a program is always indicated by the END statement. The form of this statement is
    l END
    This must be the last statement in a program. This indicates the physical end of the program.
    eg :
    1000 END
    The computer will stop the execution of the program when the END statement is executed. Even if some more statements are available after END it will not be included for execution.
    Program
    Let X = 1.11, Y = 2.22, Z= 3.33. Develop a program to compute X2+Y2 +Z2 and
    X3+Y3 +Z3.

    10 X=1.11
    20 Y=2.22
    30 Z=3.33
    40 S =X^2+Y^2+Z^2
    50 C= X^3+Y^3+Z^3
    60 PRINT X, Y, Z, S, C
    70 STOP
    80 END
    Program
    One foot = 12.0 inches, one inch = 2.54 centimeters. Develop a program to compute inches and feet of 76.2 centimeters. Print the result as
    CM = INCHES = FEET =

    10 REM PROGRAM TO COMPUTE INCHES AND
    20 REM FEET WHEN GIVEN DATUM IS IN CM
    30 READ A, B, C
    40 DATA 12.0, 2.54, 76.2
    50 J=C/B
    60 REM VARIABLE J STORES THE NUMBER OF
    70 REM INCHES IN C CENTIMETERS
    80 F=J/A
    90 REM VARIABLE F STORES THE NUMBER OF
    100 REM FEET IN J INCHES
    110 PRINT “CM =”, C,”INCHES=”,J.”FEET =”, F
    120 STOP
    130 END

    Program
    Develop a program to convert temperatures, given in degrees centigrade(C), to degrees Fahrenheit (F) using the formula
    F=(9/5)C +32

    10 REM TO CONVERT TEMPERATUER IN
    20 REM CENTIGRADE TO FAHRENHEIT
    30 PRINT “TEMP IN CENTIGRADE”;
    40 INPUT C
    50 F=(9/5)*C +32
    60 PRINT
    70 PRINT “TEMP IN FAHRENHEIT=”;F
    80 END

Last modified: Wednesday, 18 January 2012, 11:13 PM