Sha256: b8d3d3687609af0b719364908a5420ee98f0ff992f573dda9a4e35c14c8f92e2

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

INPUT "Enter first number.":first
INPUT "Enter second number.":second
PRINT "The sum of";first;"and";second;"is ";first+second&"."
PRINT "The difference between";first;"and";second;"is ";ABS(first-second)&"."
PRINT "The product of";first;"and";second;"is ";first*second&"."
IF second THEN
    PRINT "The integer quotient of";first;"and";second;"is ";INTEG(first/second)&"."
ELSE
    PRINT "Division by zero not cool."
ENDIF
PRINT "The remainder being...";first%second&"."
PRINT STR$(first);"raised to the power of";second;"is ";first^second&"."

'''NOTES:''' Some curious aspects of smart BASIC to note in this code example:
<ol>
<li>In smart BASIC, The command INTEG is a true integer function providing only the value of the characteristic. The smart BASIC INT command calculates as a rounding function. This differs from some other versions of BASIC.</li>
<li>smart BASIC automatically inserts spaces ahead of and behind numbers. This can cause unexpected formatting issues when combining output from numeric variables with text. In order to suppress the trailing space, you must use the ampersand (&amp;) to concatenate the numeric value with the following text (in this case, a period at the end of each sentence). In the case of leading spaces, you must convert the numeric value to text using the STR$ command (as with the last line of the code).
</ol>

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/arithmetic.integer/smart_basic.txt
zettacode-0.1.6 files.zettacode/arithmetic.integer/smart_basic.txt
zettacode-0.1.6 files.zettacode2/arithmetic.integer/smart_basic.txt
zettacode-0.1.5 files.zettacode/arithmetic.integer/smart_basic.txt
zettacode-0.1.5 files.zettacode2/arithmetic.integer/smart_basic.txt
zettacode-0.1.4 files.zettacode/arithmetic.integer/smart_basic.txt
zettacode-0.1.4 files.zettacode2/arithmetic.integer/smart_basic.txt
zettacode-0.1.3 files.zettacode/arithmetic.integer/smart_basic.txt
zettacode-0.1.2 files.zettacode/arithmetic.integer/smart_basic.txt
zettacode-0.1.1 zettacode.files/arithmetic.integer/smart_basic.txt