Use of Semicolon in the PRINT statement

Use of Semicolon in the PRINT statement
     
The different quantities appearing in the list of the PRINT statement can be separated by semicolons. For instance, we can specify
33 PRINT A; B; -8; D/E
When the semicolon is used as the delimiter, there is less space between the printed values. i.e values are ‘squeezed’ and we get results in a ‘packed’ format.
Eg:
34 PRINT 2116; 126; -67
The printed output may appear as
2116 126 -67
35 PRINT “GOBIND” ; ”SINGH”
The output generated appear as
GOBINDSINGH
If you wish to have a space between the words GOBIND and SINGH, specify statement 35 as
35 PRINT “GOBIND”; “^”; “SINGH”
Or as
35 PRINT “GOBIND^” ; “SINGH”
semicolons and commas may be mixed in the PRINT list items
Eg:
38 PRINT “P=”; -20, “Q=”; 7777
This generates the output as
P = -20 Q= 7777
Program :
Let X = 1.11, Y = 2.22, Z= 3.33. Develop a program to compute X2+Y2 +Z2 and
X3+Y3 +Z3.
10 LET X=1.11
20 LET Y=2.22
30 LET Z=3.33
40 LET S =X^2+Y^2+Z^2
50 LET C= X^3+Y^3+Z^3
60 PRINT X, Y, Z, S, C
70 STOP
80 END

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