RosettaCodeData/Task/Arithmetic-Integer/FreeBASIC/arithmetic-integer.basic

17 lines
471 B
Plaintext

' FB 1.05.0 Win64
Dim As Integer i, j
Input "Enter two integers separated by a comma"; i, j
Print i;" + "; j; " = "; i + j
Print i;" - "; j; " = "; i - j
Print i;" * "; j; " = "; i * j
Print i;" / "; j; " = "; i \ j
Print i;" % "; j; " = "; i Mod j
Print i;" ^ "; j; " = "; i ^ j
Sleep
' Integer division (for which FB uses the '\' operator) rounds towards zero
' Remainder (for which FB uses the Mod operator) will, if non-zero, match the sign
' of the first operand