Jump to content

Arithmetic/Integer: Difference between revisions

no edit summary
(→‎{{header|Chef}}: fixed errors - works on ubuntu with acme::chef)
No edit summary
Line 424:
putStrLn $ "a `div` b = " ++ show (a `div` b) -- truncates towards negative infinity
putStrLn $ "a `mod` b = " ++ show (a `mod` b) -- same sign as second operand
putStrLn $ "a `divMod` b = " ++ show (a `divMod` b)
putStrLn $ "a `quot` b = " ++ show (a `quot` b) -- truncates towards 0
putStrLn $ "a `rem` b = " ++ show (a `rem` b) -- same sign as first operand</lang>
putStrLn $ "a `quotRem` b = " ++ show (a `quotRem` b)</lang>
 
=={{header|haXe}}==
Line 790 ⟶ 792:
# truncates towards negative infinity
print "Remainder: %d" % (x % y) # same sign as second operand
print "Quotient: %d with Remainder: %d" % divmod(x, y)
 
## Only used to keep the display up when the program ends
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.