Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 94076

Challenges related to elementary arithmetic.

3 votes

What do you get when you multiply 6 by 9? (42)

Pascal, 69 characters function p(x,y:integer):integer;begin p:=x*y-12*ord(x=6)*ord(y=9)end; expanded function product(x, y: integer): integer; begin product := x * y - 12 * ord(x = 6) * ord(y = 9 …
Kai Burghardt's user avatar
1 vote

Reciprocal of a number (1/x)

Pascal, 40 bytes The built-in data type real provides an implementation-defined approximation. function f(x:real):real;begin f:=1/x end
Kai Burghardt's user avatar
3 votes

Summing the Digits of a Number

Pascal, 114 bytes This is a full program according to ISO standard 7185 “Standard Pascal”. The built-in data type integer comprises (at least) all integral values in the range −maxInt..maxInt. The val …
Kai Burghardt's user avatar
1 vote

Find your dog's age

HP‑41C series, 18 B You must place \$n\$ on top of the stack first (a. k. a. the X register). Then you can XEQ (execute) the following program: 01♦LBL "Y" 5 Bytes global label requires 4 + …
Kai Burghardt's user avatar
2 votes

Implement division

Pascal, 54 B In the era Pascal was conceived, slide rules were a standard tool among engineers. This was probably motivation to include ln (natural logarithm) and exp (exponenantion) to be part of the …
Kai Burghardt's user avatar
1 vote

Is this even or odd?

Pascal, ≥ 6 B odd(x) where x is an integer variable or expression returns the Boolean value true if x mod 2 = 1, otherwise false.
Kai Burghardt's user avatar
0 votes

The vanilla factorial challenge

HP‑41C series, 1 B Place \$n\$ into the X register (that is the top of the stack) and XEQ (execute) the built‑in command FACT \$n!\$ is now in the X register and \$n\$ in the L (“last X”) register. T …
Kai Burghardt's user avatar
0 votes

The vanilla factorial challenge

Pascal, 27 B The source code is split into a left half containing the boilerplate for a complete Pascal program, and right half containing the necessary step to evaluate \$n!\$ (i. e. the task). Only …
Kai Burghardt's user avatar
1 vote

1, 2, Fizz, 4, Buzz

Pascal, 162 B See also Free Pascal. This program, however, requires a processor supporting features of ISO standard 10206 “Extended Pascal”, specifically the :0 width specifier in conjunction with str …
Kai Burghardt's user avatar
0 votes

Divisibility test

Pascal, 54 B d divides n if division with remainder (Pascal’s div and mod operators) yields no remainder (the result of the mod operation), i. e. a value of zero. function f(n,d:integer):Boolean;begin …
Kai Burghardt's user avatar