Arithmetic/Integer: Difference between revisions

Add LIL
(Add Genie)
(Add LIL)
Line 2,394:
print "The first raised to the power of the second is " ; first ^second
</lang>
 
=={{header|LIL}}==
<lang tcl># Arithmetic/Integer, in LIL
write "Enter two numbers separated by space: "
if {[canread]} {set line [readline]}
print
 
set a [index $line 0]
set b [index $line 1]
print "A is $a"", B is $b"
print "Sum A + B is [expr $a + $b]"
print "Difference A - B is [expr $a - $b]"
print "Product A * B is [expr $a * $b]"
print "Integer Quotient A \\ B is [expr $a \ $b], truncates toward zero"
print "Remainder A % B is [expr $a % $b], sign follows first operand"
print "LIL has no exponentiation expression operator"</lang>
 
{{out}}
<pre>prompt$ echo '7 4' | lil arithmeticInteger.lil
Enter two numbers separated by space:
A is 7, B is 4
Sum A + B is 11
Difference A - B is 3
Product A * B is 28
Integer Quotient A \ B is 1, truncates toward zero
Remainder A % B is 3, sign follows first operand
LIL has no exponentiation expression operator
 
prompt$ echo '-7 4' | lil arithmeticInteger.lil
Enter two numbers separated by space:
A is -7, B is 4
Sum A + B is -3
Difference A - B is -11
Product A * B is -28
Integer Quotient A \ B is -1, truncates toward zero
Remainder A % B is -3, sign follows first operand
LIL has no exponentiation expression operator</pre>
 
=={{header|Lingo}}==
Anonymous user