Integer-Digits of the Arithmetic-Tables
JavaScript (ES7), 128 bytes
f=
c=>[...c+`0123456789`].map((r,_,a)=>a.map(l=>l==c?r:r==c?l:/^\d$/.test(l=c<`^`?eval(l+c+r):l|c?l**r:l/r)?l:` `).join` `).join`
`
<select onchange=o.textContent=f(this.value)><option>><option>+<option>-<option>*<option>/<option>%<option>^<option>&<option>,<option>.</select><pre id=o>
Special-casing 0^0
cost me 8 bytes.
Japt, 45 bytes
Collaborated with @ETHproductions
AÆAÇU¥'p«Z«XªOvZ+U+X)+P r"..+"SÃuXÃuAo uU)m¸·
Run it online!
Takes input as:
"+"
for addition
"-"
for subtraction
"*"
for multiplication
"/"
for division
"p"
for exponentiation
"%"
for modulo
Explanation (With expanded shortcuts):
AÆ AÇ U¥ 'p« Z« Xª OvZ+U+X)+P r"..+"SÃ uXÃ uAo uU)m¸ ·
AoX{AoZ{U=='p&&!Z&&!X||OvZ+U+X)+P r"..+"S} uX} uAo uU)mqS qR
A // By default, 10 is assigned to A
o // Create a range from [0...9]
X{ } // Iterate through the range, X becomes the iterative item
Ao // Create another range [0...9]
Z{ } // Iterate through the range, Z becomes the iterative item
// Take:
U=='p // U (input) =="p"
&&!Z // && Z != 0
&&!X // && X != 0
|| // If any of these turned out false, instead take
Ov // Japt Eval:
Z+U+X // Z{Input}X
)+P // Whichever it was, convert to a string
r"..+"S // Replace all strings of length 2 or more with " "
// (this makes sure the result !== "false" and has length 1)
uX // Insert X (the row number) into the front of the row
u // Insert at the beginning the first row:
Ao // [0...9]
uU) // with the input inserted at the beginning
mqS // Join each item in the final array with " "
qR // Join the final array with "\n"
Operation Flashpoint scripting language, 343 333 303 301 bytes
f={o=_this;s=o+" 0 1 2 3 4 5 6 7 8 9\n";i=0;while{i<10}do{j=0;s=s+format["%1",i];if(i<1&&(o=="/"||o=="%"||o=="^"))then{if(o=="^")then{if(j<1)then{s=s+" ";j=1}}else{s=s+"\n1";i=1}};while{j<10}do{r=call format["%1%2%3",j,o,i];if(r>9||r<0||r%1>0)then{r=" "};s=s+format[" %1",r];j=j+1};s=s+"\n";i=i+1};s}
Call with:
hint ("+" call f)
Ungolfed:
f=
{
o=_this;
s=o+" 0 1 2 3 4 5 6 7 8 9\n";
i=0;
while{i<10}do
{
j=0;
s=s+format["%1",i];
if(i<1&&(o=="/"||o=="%"||o=="^"))then
{
if(o=="^")then{if(j<1)then{s=s+" ";j=1}}
else{s=s+"\n1";i=1}
};
while{j<10}do
{
r=call format["%1%2%3",j,o,i];
if(r>9||r<0||r%1>0)then{r=" "};
s=s+format[" %1",r];
j=j+1
};
s=s+"\n";
i=i+1
};
s
}
Output:
operator +
operator -
operator *
operator /
operator ^
operator %