Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,20 +0,0 @@
with Ada.Text_Io;
with Ada.Integer_Text_IO;
procedure Integer_Arithmetic is
use Ada.Text_IO;
use Ada.Integer_Text_Io;
A, B : Integer;
begin
Get(A);
Get(B);
Put_Line("a+b = " & Integer'Image(A + B));
Put_Line("a-b = " & Integer'Image(A - B));
Put_Line("a*b = " & Integer'Image(A * B));
Put_Line("a/b = " & Integer'Image(A / B));
Put_Line("a mod b = " & Integer'Image(A mod B)); -- Sign matches B
Put_Line("remainder of a/b = " & Integer'Image(A rem B)); -- Sign matches A
Put_Line("a**b = " & Integer'Image(A ** B));
end Integer_Arithmetic;

View file

@ -1,4 +1,11 @@
set /p equation=
set /a result=%equation%
echo %result%
@echo off
echo Batch rounds towards zero and its modulus should match the sign of the first operand.
set /p a=
set /p b=
set /a "sum=a+b, difference=a-b, product=a*b, intmod=a/b, remainder=a%%b"
echo a + b = %sum%
echo a - b = %difference%
echo a * b = %product%
echo a / b = %intmod%
echo a %%(%%^) b = %remainder%
pause

View file

@ -1,44 +0,0 @@
IDENTIFICATION DIVISION.
PROGRAM-ID. Int-Arithmetic.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC S9(10).
01 B PIC S9(10).
01 Result PIC S9(10).
PROCEDURE DIVISION.
DISPLAY "First number: " WITH NO ADVANCING
ACCEPT A
DISPLAY "Second number: " WITH NO ADVANCING
ACCEPT B
* *> Note: The various ADD/SUBTRACT/etc. statements can be
* *> replaced with COMPUTE statements, which allow those
* *> operations to be defined similarly to other languages,
* *> e.g. COMPUTE Result = A + B
ADD A TO B GIVING Result
DISPLAY "A + B = " Result
SUBTRACT B FROM A GIVING Result
DISPLAY "A - B = " Result
MULTIPLY A BY B GIVING Result
DISPLAY "A * B = " Result
* *> Division here truncates towards zero. DIVIDE can take a
* *> ROUNDED clause, which will round the result to the nearest
* *> integer.
DIVIDE A BY B GIVING Result
DISPLAY "A / B = " Result
COMPUTE Result = A ^ B
DISPLAY "A ^ B = " Result
* *> Matches sign of first argument.
DISPLAY "A % B = " FUNCTION REM(A, B)
GOBACK
.

View file

@ -1,7 +1,7 @@
import system'math;
import extensions;
public program()
public Program()
{
var a := Console.loadLineTo(new Integer());
var b := Console.loadLineTo(new Integer());

View file

@ -1,13 +0,0 @@
include get.e
integer a,b
a = floor(prompt_number("a = ",{}))
b = floor(prompt_number("b = ",{}))
printf(1,"a + b = %d\n", a+b)
printf(1,"a - b = %d\n", a-b)
printf(1,"a * b = %d\n", a*b)
printf(1,"a / b = %g\n", a/b) -- does not truncate
printf(1,"remainder(a,b) = %d\n", remainder(a,b)) -- same sign as first operand
printf(1,"power(a,b) = %g\n", power(a,b))

View file

@ -1,16 +0,0 @@
class Main {
static public function main():Void {
var input_a = Sys.stdin().readLine();
var input_b = Sys.stdin().readLine();
var a = Std.parseInt(input_a);
var b = Std.parseInt(input_b);
trace(a + b);
trace(a - b);
trace(a * b);
trace(Std.int(a / b));
trace(a % b);
trace(Math.pow(a, b));
}
}

View file

@ -1,3 +1,6 @@
REM https://github.com/Eva-Broccoli/OPL-Rosetta-Code/blob/main/Armtintg.opl
REM While OPL has an INT() function, it is not necessary here because OPL always uses the simplest arithmetic possible for the numbers involved. If all numbers involved are integers, integer arithmetic is used.
REM For remainder, positive numbers are rounded down; negative numbers are rounded up.
PROC main:
LOCAL a%,b%
PRINT "Please enter a number:",

View file

@ -1,9 +0,0 @@
$a = [int] (Read-Host First Number)
$b = [int] (Read-Host Second Number)
Write-Host "Sum: $($a + $b)"
Write-Host "Difference: $($a - $b)"
Write-Host "Product: $($a * $b)"
Write-Host "Quotient: $($a / $b)"
Write-Host "Quotient, round to even: $([Math]::Round($a / $b))"
Write-Host "Remainder, sign follows first: $($a % $b)"

View file

@ -1 +0,0 @@
[Math]::Pow($a, $b)

View file

@ -1,51 +0,0 @@
REBOL [
Title: "Integer"
URL: http://rosettacode.org/wiki/Arithmetic/Integer
]
x: to-integer ask "Please type in an integer, and press [enter]: "
y: to-integer ask "Please enter another integer: "
print ""
print ["Sum:" x + y]
print ["Difference:" x - y]
print ["Product:" x * y]
print ["Integer quotient (coercion) :" to-integer x / y]
print ["Integer quotient (away from zero) :" round x / y]
print ["Integer quotient (halves round towards even digits) :" round/even x / y]
print ["Integer quotient (halves round towards zero) :" round/half-down x / y]
print ["Integer quotient (round in negative direction) :" round/floor x / y]
print ["Integer quotient (round in positive direction) :" round/ceiling x / y]
print ["Integer quotient (halves round in positive direction):" round/half-ceiling x / y]
print ["Remainder:" r: x // y]
; REBOL evaluates infix expressions from left to right. There are no
; precedence rules -- whatever is first gets evaluated. Therefore when
; performing this comparison, I put parens around the first term
; ("sign? a") of the expression so that the value of /a/ isn't
; compared to the sign of /b/. To make up for it, notice that I don't
; have to use a specific return keyword. The final value in the
; function is returned automatically.
match?: func [a b][(sign? a) = sign? b]
result: copy []
if match? r x [append result "first"]
if match? r y [append result "second"]
; You can evaluate arbitrary expressions in the middle of a print, so
; I use a "switch" to provide a more readable result based on the
; length of the /results/ list.
print [
"Remainder sign matches:"
switch length? result [
0 ["neither"]
1 [result/1]
2 ["both"]
]
]
print ["Exponentiation:" x ** y]

View file

@ -1,24 +1,22 @@
/*REXX program obtains two integers from the C.L. (a prompt); displays some operations.*/
numeric digits 20 /*#s are round at 20th significant dig.*/
parse arg x y . /*maybe the integers are on the C.L. */
-- 24 Sep 2025
include Setting
do while \datatype(x,'W') | \datatype(y,'W') /*both X and Y must be integers. */
say "─────Enter two integer values (separated by blanks):"
parse pull x y . /*accept two thingys from command line.*/
end /*while*/
/* [↓] perform this DO loop twice. */
do j=1 for 2 /*show A oper B, then B oper A.*/
call show 'addition' , "+", x+y
call show 'subtraction' , "-", x-y
call show 'multiplication' , "*", x*y
call show 'int division' , "%", x%y, ' [rounds down]'
call show 'real division' , "/", x/y
call show 'division remainder', "//", x//y, ' [sign from 1st operand]'
call show 'power' , "**", x**y
say 'ARITHMETIC - INTEGER'
say version
say
arg x','y
if x='' then
x=3
if y='' then
y=7
say 'All supported operations on integers...'
say 'Addition x+y = ' x+y
say 'Subtraction x-y = ' x-y
say 'Multiplication x*y = ' x*y
say 'Integer division x%y = ' x%y '(rounds towards zero)'
say 'Real division x/y = ' x/y '(might be floating point)'
say 'Remainder x//y =' x//y
say 'Exponentiation x**y =' x**y '(might be floating point)'
exit
parse value x y with y x /*swap the two values and perform again*/
if j==1 then say copies('', 79) /*display a fence after the 1st round. */
end /*j*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
show: parse arg c,o,#,?; say right(c,25)' ' x center(o,4) y " ───► " # ?; return
include Math

View file

@ -1,14 +0,0 @@
let a = int_of_string(Sys.argv[2])
let b = int_of_string(Sys.argv[3])
let sum = a + b
let difference = a - b
let product = a * b
let division = a / b
let remainder = mod(a, b)
Js.log("a + b = " ++ string_of_int(sum))
Js.log("a - b = " ++ string_of_int(difference))
Js.log("a * b = " ++ string_of_int(product))
Js.log("a / b = " ++ string_of_int(division))
Js.log("a % b = " ++ string_of_int(remainder))

View file

@ -1,17 +0,0 @@
option explicit
dim a, b
wscript.stdout.write "A? "
a = wscript.stdin.readline
wscript.stdout.write "B? "
b = wscript.stdin.readline
a = int( a )
b = int( b )
wscript.echo "a + b=", a + b
wscript.echo "a - b=", a - b
wscript.echo "a * b=", a * b
wscript.echo "a / b=", a / b
wscript.echo "a \ b=", a \ b
wscript.echo "a mod b=", a mod b
wscript.echo "a ^ b=", a ^ b

View file

@ -1,14 +0,0 @@
option explicit
dim a, b
wscript.stdout.write "A? "
a = wscript.stdin.readline
wscript.stdout.write "B? "
b = wscript.stdin.readline
a = int( a )
b = int( b )
dim op
for each op in split("+ - * / \ mod ^", " ")
wscript.echo "a",op,"b=",eval( "a " & op & " b")
next