Site pages
Current course
Participants
General
Topic 1
Topic 2
Topic 3
Topic 4
Topic 5
Topic 6
Topic 7
Topic 8
Topic 9
Topic 10
Topic 11
Topic 12
Topic 13
Topic 14
Topic 15
Topic 16
Topic 17
Topic 18
Topic 19
Topic 20
Topic 21
Topic 22
Topic 23
Topic 24
Topic 25
Topic 26
Topic 27
Topic 28
Topic 29
Topic 30
Topic 31
Topic 32
Topic 33
Topic 34
Topic 35
The STOP and END statements
The form of STOP statement is 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 Program20 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 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