Arithmetic/Integer: Difference between revisions

Content added Content deleted
(→‎{{header|UNIX Shell}}: SUSv3 says that $(($x)) and $((x)) are alike, so remove the extra dollar signs.)
m (→‎{{header|AWK}}: Make the comments like the other examples.)
Line 188: Line 188:
print "sub:", $1 - $2
print "sub:", $1 - $2
print "mul:", $1 * $2
print "mul:", $1 * $2
print "div:", int($1 / $2) # rounds toward zero
print "div:", int($1 / $2) # truncates toward zero
print "mod:", $1 % $2 # follows first sign
print "mod:", $1 % $2 # same sign as first operand
print "exp:", $1 ** $2
print "exp:", $1 ** $2
exit }</lang>
exit }</lang>