[Question]
  [
You must make a [polyglot](/questions/tagged/polyglot "show questions tagged 'polyglot'") that outputs the square of the input in one language and the square root of the input in another. The shortest answer in bytes wins!
You must have a precision of at least 3 decimal places, and the input will always be a positive float.
  
[Answer]
# C and C++, ~~68~~ 65 bytes
```
#include<math.h>
float f(float n){auto p=.5;return pow(n,2-p*3);}
```
Original answer:
```
#include<math.h>
float f(float n){return pow(n,sizeof('-')-1?2:.5);}
```
For both versions, C produces `n^2` and C++ produces `sqrt(n)`.
[Answer]
# Python 2 & Python 3, ~~23~~ 21 bytes
```
lambda n:n**(1/2or 2)
```
Python 2.x produces `n^2`, Python 3.x produces `sqrt(n)`.
2 bytes saved thanks to @Dennis!
[Answer]
# [Jolf](https://github.com/ConorOBrien-Foxx/Jolf/) and [MATL](https://github.com/lmendo/MATL), 1 byte
```
U
```
Square root in Jolf, square in MATL.
[Try it online!](https://tio.run/##y00syfn/P/T/fxM9UwA "MATL – Try It Online") (MATL)
[Try the Jolf code.](http://conorobrien-foxx.github.io/Jolf/#code=VQ&input=NC41) Only works on Firefox.
These are both 1 byte, as MATL and Jolf both use ASCII/extended ASCII codepages, so all commands are 1 byte.
[Answer]
# [2sable](https://github.com/Adriandmen/2sable) / [Jelly](https://github.com/DennisMitchell/jelly), 2 bytes
```
*.
```
2sable computes the square. [Try it online!](https://tio.run/nexus/2sable#@6@l9/@/oQEA "2sable – TIO Nexus")
Jelly computes the square root. [Try it online!](https://tio.run/nexus/jelly#@6@l9///f0MDAA "Jelly – TIO Nexus")
## How it works
### 2sable
```
*   Read the input twice and compute the product of both copies.
    This pushes the square of the input.
 .  Unrecognized token (ignored).
```
### Jelly
```
 .  Numeric literal; yield 0.5.
*   Raise the input to the power 0.5.
    This yields the square root.
```
[Answer]
# [C (clang)](http://clang.llvm.org/) and [Python](http://www.python.org), ~~109~~ ~~107~~ ~~69~~ 53 bytes
```
#/*
lambda n:n**.5;'''*/
float a(i){return i*i;}//'''
```
C: [Try it online!](https://tio.run/nexus/c-clang#LYtBCoMwEEX3niIommQQAy3dNHiY0RgY0GmJ6Sp49jRClv@993NnoNnxWBwKfjPA9LJSSjCN3z8YBSrSKWzxF1gQkL2MKToTR3EgsdKphs6eK7JXbe/bcXDaVk6PGdU9v6Gcqi@0kCs//w "C (clang) – TIO Nexus")
Python: [Try it online!](https://tio.run/nexus/python2#@6@sr8WVk5iblJKokGeVp6WlZ2qtrq6upc@VlpOfWKKQqJGpWV2UWlJalKeQqZVpXauvD5T@n2aLqoeroCgzr0QhTSMzr6C0RENT878lAA "Python 2 – TIO Nexus")
Works by using comments to polyglot. The rest is pretty explanatory.
First time using C!
* Saved quite a few bytes thanks to @Riker.
* Saved 2 bytes by removing unnecessary whitespace.
* Saved very many bytes by using a function for C instead of STDIN/OUT.
* Saved 16 bytes thanks to @Delioth by removing import statement at the top.
[Answer]
# [Ohm](https://github.com/MiningPotatoes/Ohm) and [Jelly](https://github.com/DennisMitchell/jelly), 3 bytes
Outputs the square in Ohm, the square root in Jelly.
Ohm and Jelly use different single-byte codepages, so the program will appear differently in each encoding. 
xxd hexdump of the program:
```
00000000: fd7f 0a                                  ...
```
### Jelly
Using Jelly's codepage, it appears like this:
```
’
½
```
Jelly takes the bottom most line to be its main link, and ignores the other links unless specifically called. So here it just does the square root (`½`) and implicitly outputs it.
### Ohm
Using Ohm's codepage (CP437), it appears like this:
```
²⌂◙
```
`²` is the square function, and `⌂` and `◙` are both undefined, so the program just squares the implicitly read input and implicitly outputs it.
[Answer]
# C89 and C99, 47+3 = 50 bytes
```
float f(float n){return n//*
/sqrt(n)//*/1*n
;}
```
Requires `-lm` flag (+3)
C89 produces `n^2`, C99 produces `sqrt(n)`. To test in C89, [Try it online!](https://tio.run/nexus/c-gcc#JYtBDoIwEADvfUWDMekSodGTBPUlXprCapOyaLucCF93bcJpZg4jGGfHGs1OgjWNvCTSZG2tbP4mNgTF7bkm1W/qEMjHZRhvmYcwt@@HCsR6coEMrJ9UAk11jPik6oTmAtBvIj@P0b2yNGW6@2snTZz@ "C (gcc) – TIO Nexus")
---
Getting C89 to do the `sqrt` version ought to take less code, but it insists on implicitly declaring the `sqrt` function with `int`s, so this is the best I could manage.
[Answer]
# Octave / MATLAB, ~~31~~ 29 bytes
```
 @(x)x^(2-3*any(version>60)/2)
```
This outputs the square in Octave, and the square root in MATLAB.
**Explanation:**
The syntax is of course identical in MATLAB and Octave (for this little piece of code at least).
This creates an anonymous function:
```
@(x)                                 % Take x as input
    x^(                     )        % Raise x to the power of ...   
               version                 % Returns the version number
                                       % 4.2.0 in Octave, 
                                       % '9.2.0.538062 (R2017a)' in MATLAB
               version>60              % 'R' is larger than 60. All others are smaller
         3*any(version>60)/2           % Checks if there is an 'R' and multiplies it by 1.5 if it is.
       2-3*any(version>60)           % 2-1.5*(is there an 'R')
       
```
[Answer]
# Basic / Delphi – 6 characters
```
sqr(x)
```
Square root in Basic and square in Delphi.
You can use a debugger to inspect the expression, thereby fulfilling any output requirements!
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E) / [Fireball](https://github.com/okx-code/Fireball), 3 bytes
The following bytes make up the program:
```
FD B9 74
```
05AB1E calculates square root, Fireball squares.
Explanation (05AB1E - `ý¹t`):
```
ý       Pushes an empty string to the stack (not entirely sure why)
 ¹      Push first input
  t     Square root
```
Explanation (Fireball - `²╣t`):
```
²       Square input
 ╣      Unassigned
  t     Unassigned
```
Sometimes, it helps to have an incomplete language ;)
[Answer]
# PHP7 + JavaScript, ~~62~~ ~~61~~ 58 bytes
This was actually more challenging than I expected! I am quite surprised of how long my code is.
```
eval(['alert((_=prompt())*_)','echo$argv[1]**.5'][+![]]);
```
---
**How does it work?**
This works by selecting the code to run, from the array.  
PHP and JavaScript detection is made with `+![]`.
In PHP, `[]` (empty array) is a falsy value, while in JavaScript it is a truthy value (objects (except `null`) are always truthy, even `new Boolean(false)` is truthy!).  
But, I need to get it to a numeric value, so, I just use a `not` (`!`) and convert it to integer (with the `+`).  
Now, PHP yields the value `1`, while JavaScript yields `0`.  
Placing the code inside an array, at those indexes, will allow us to select the right code for the desired language.  
This can be used as `[JS,PHP][+![]]`, to get the code of the right language.
On previous polyglots, I've used `'\0'=="\0"`, which is `true` in JavaScript (since `\0` is parsed as the NULL-byte) and `false` in PHP (the `'\0'` won't be parsed as the NULL-byte, comparing the literal string `\0` with the NULL-byte).  
I'm happy that I've managed to reduce this check to `+!'0'`.  
I'm even more happy about [@rckd](https://codegolf.stackexchange.com/users/68084/rckd), which reduced it to the current version!
From there on, it simply `eval`s the code required.
**PHP**
PHP will execute `echo$argv[1]**.5` (equivalent to `echo sqrt($argv[1]);`, square-root the number), receiving the value from the 2nd argument and displays it in the standard output.
**JavaScript**
JavaScript executes `alert((_=prompt())*_)`, which displays the squared number in an `alert`.
---
---
Thank you to [@rckd](https://codegolf.stackexchange.com/users/68084/rckd) for saving 1 byte, and [@user59178](https://codegolf.stackexchange.com/users/59178/user59178) for saving 3 bytes!
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E) and [Jelly](https://github.com/DennisMitchell/jelly), 4 bytes
```
nqƓ½
```
[(05AB1E)](https://tio.run/nexus/05ab1e#@59XeGzyob3//xt9zcvXTU5MzkgFAA "05AB1E – TIO Nexus") - [(Jelly)](https://tio.run/nexus/jelly#@59XeGzyob3//5sAAA "Jelly – TIO Nexus")
```
nq   # Ignored by Jelly, push n**2 in 05AB1E then quit.
  Ɠ½ # Ignored by 05AB1E due to quit, push sqroot of input in Jelly.
```
---
Someone else made a good point, I guess since the UTF-8 characters do not share the same operation across code pages that they are technically 2-bytes each to encode. However, when looking at this in terms of the hex dump:
```
6e 71 93 0a
```
In 05AB1E's CP1252 encoding this results in:
```
nq“\n
```
Meaning it will still output the square and quit, ignoring the rest. When these bytes are encoded using Jelly's codepage:
```
nqƓ½
```
Which is the original intended code, when executed, results in the desired result of taking the input and taking the sqrt.
[Answer]
# Python 2 and Forth, ~~43~~ 33 bytes
```
( """ )
fsqrt
\ """);lambda n:n*n
```
**Try it online: [Python 2](https://tio.run/nexus/python2#@6@hoKSkpKDJlVZcWFTCFQPiaVqn2eYk5ialJCrkWeVp5f0vKMrMK1FI0zDWMzQx1PwPAA) (square) | [Forth](https://tio.run/nexus/forth-gforth#MzY0MUzVNf6voaCkpKSgyZVWXFhUwhUD4mla5yTmJqUkKuRZ5Wnl/U/T@w8A) (sqrt)**
This evaluates to an anonymous function in Python, and a built-in function `fsqrt` in Forth. Python can have a named function `f` for 2 bytes more by putting `f=` in front of the lambda.
The Forth program takes a [floating point literal](https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Floating-Point-Tutorial.html), which in Forth must be written in scientific notation. Pi truncated to 3 decimal places (`3.141`) would be written like this:
```
3141e-3
```
[Answer]
# JavaScript (ES6) / JavaScript (ES7), 52 bytes
```
f=a=>eval(`try{eval("a**2")}catch(e){Math.sqrt(a)}`)
```
Returns the square of the input in ES7 and the square root in ES6. Quite difficult to test, unless you have an older browser which support ES6 but not ES7.
```
f=a=>eval(`try{eval("a**2")}catch(e){Math.sqrt(a)}`)
console.log(f(4));
```
[Answer]
# [CJam](https://sourceforge.net/projects/cjam/) / [MATL](https://github.com/lmendo/MATL), 8 bytes
```
ld_*GX^!
```
Computes the square in CJam ([Try it online!](https://tio.run/nexus/cjam#@5@TEq/lHhGn@P@/kYGekSkA)) and the square root in MATL ([Try it online!](https://tio.run/nexus/matl#@5@TEq/lHhGn@P@/kYGekSkA)).
### Explanation of square in CJam
```
ld    e# Read input line and interpret as a double
_     e# Duplicate
*     e# Multiply. Pops the input number twice, pushes its square
G     e# Push 16
X     e# Push 1
^     e# Bitwise XOR. Pops 16 and 1, and pushes 17
!     e# Negate. Pops 17, pushes 0
      e# Implicitly display. This prints the squared input with decimals,
      e# immediately followed by the 0 coming from the negate operation
      e# Even if the square of the input number is an integer, say 5,
      e# it is displayed as 5.0, so including an extra 0 always gives a
      e# correct result
```
### Explanation of square root in MATL
```
l      % Push 1. This is a number or equivalently a 1×1 array
d      % Consecutive differences. Pops 1, pushes [] (empty array)
_      % Negate (element-wise). This leaves [] as is
*      % Implicitly input a number and push it. Multiply (element-wise): 
       % pops [] and the input number, pushes []
G      % Push input number again
X^     % Square root. Pops number, pushes its square root
!      % Transpose. For a number (1×1 array) this does nothing
       % Implicitly display. The stack contains [] and the result; but 
       % [] is not displayed at all
```
[Answer]
# C, [Operation Flashpoint](https://en.wikipedia.org/wiki/Operation_Flashpoint:_Cold_War_Crisis) scripting language, 52 bytes
```
;float f(float x){return sqrt(x);}char*
F="_this^2";
```
In an OFP script, a semicolon at the beginning of a line makes that line a comment, whereas C doesn't care about the additional semicolon.
**C:**
[Try it online!](https://tio.run/nexus/c-gcc#@2@dlpOfWKKQpgGhKzSri1JLSovyFIoLi0o0KjSta5MzEou0uNxsleJLMjKL44yUrP9n5pUo5CZm5mloclVzKQBBQRFQKE1DSTVNSQdolpGmpjVX7f9/yWk5ienF/3VzcgE)
**OFP scripting language:**
Save as `init.sqs` in the mission folder, then call it with `hint format["%1", 2 call F]`.
Result: [![enter image description here](https://i.stack.imgur.com/uxdp3.jpg)](https://i.stack.imgur.com/uxdp3.jpg)
[Answer]
# [Vyxal](https://github.com/Lyxal/Vyxal), [Grok](https://github.com/AMiller42/Grok-Language) ~~10~~ 12 bytes
*Edit: In my first version, I forgot that casting to `int` would remove precision in the Vyxal code. Added +2 bytes to fix it.*
```
I√`#:Yp*zq`_
```
Vyxal (Square Root):
```
              # Implicit input
I             # Cast to int
 √            # Square root
  `#:Yp*zq`   # Push string
           _  # Delete string
              # Implicit output
```
[Try it Online in Vyxal!](http://lyxal.pythonanywhere.com/?flags=&code=I%E2%88%9A%60%23%3AYp*zq%60_&inputs=10&header=&footer=)
Grok (Square):
```
I√            # Push '√' to the register
  `#          # Skip ‘#’ command
    :         # Take input from STDIN
     Yp       # Duplicate
       *z     # Multiply and output as int
         q    # Quit
          `_  # Never gets executed
```
[Try it Online in Grok!](http://grok.pythonanywhere.com?flags=&code=I%E2%88%9A%60%23%3AYp*zq%60_&inputs=10)
[Answer]
# PHP and [CJam](https://sourceforge.net/p/cjam), ~~30~~ ~~29~~ 25 bytes
```
ECHO"$argv[1]"**2;#];rdmq
```
Calculates the square in PHP and the square root in CJam. Has to be run using `-r` in PHP.
### PHP
Raises the first command line argument (`$argv[1]`) to the power 2 and outputs it. Here `$argv[1]` is actually put as an inline variable in a string, which is cast to a number before doing the exponentiation. This is because `v` is not a valid instruction in CJam and will cause it to error out while parsing, but putting it in a string won't cause any problems.
`#` starts a comment, so everything after is ignored.
[Try it online!](https://tio.run/nexus/php#s7EvyCj47@rs4a@kkliUXhZtGKukpWVkrRxrXZSSW/j//39LAA)
### CJam
The first part of the code, `ECHO"$argv[1]"**2;#` pushes a bunch of values and does a bunch of operations, all of which are thoroughly useless. The only important thing is that they doesn't cause any errors, because right afterwards is `];`, which wraps the entire stack in an array and then discards it.
After that, it reads a double from input (`rd`), and gets its square root (`mq`), and implicitly outputs it.
[Try it online!](https://tio.run/nexus/cjam#@@/q7OGvpJJYlF4WbRirpKVlZK0ca12Uklv4/78lAA "CJam – TIO Nexus")
[Answer]
# [Desmos](https://www.desmos.com/calculator) and [Pip](https://github.com/dloscutoff/pip), 12 bytes
```
YRTa
f(y)=yy
```
[Run in Desmos](https://www.desmos.com/calculator/yw4ip1tet6)
[Run in Pip](https://ato.pxeger.com/run?1=m724ILNgwYKlpSVpuhZrIoNCErnSNCo1bSsrIUJQmZXRxnqGJoamlrFQAQA)
### Desmos
The first line is four undefined variables multiplied together. Desmos complains about it, but ultimately it's a no-op.
The second line defines a function `f(y)` as `y` times `y` (with an implicit multiplication operator). This function can be used in other lines and will return the square of any argument number. As a bonus, we also get to see a graph of `x = f(y)`.
### Pip
`RTa` calculates the square root of the command-line argument `a`, and `Y` stores the result in `y`. The second line parses as three expressions:
* `f` (evaluates to the main function)
* `(y)=y` (evaluates to `1` because `y` always equals itself)
* `y` (evaluates to the value stored in `y` previously)
The last of these expressions ends the program and is therefore autoprinted.
[Answer]
# [Python](https://python.org) / [PARI/GP](https://pari.math.u-bordeaux.fr), 60 bytes
```
#/*
n=int(input());print(n**2);"""*/
print(sqrt(input))\\"""
```
Basically a modification from the [C / Python answer](https://codegolf.stackexchange.com/a/116159/107017).  
Python does square. PARI/GP does square root.  
Takes input from `stdin`.  
Python: [Try It Online!](https://tio.run/##K6gsycjPM/7/X1lfiyvPNjOvRCMzr6C0RENT07qgCMTN09Iy0rRWUlLS0ueCiBQXFkFVaWrGxABl/v83MgUA)
PARI/GP: [Try It Online!](https://tio.run/##K0gsytRNL/j/X1lfiyvPNjOvRCMzr6C0RENT07qgCMTN09Iy0rRWUlLS0ueCiBQXFkFVaWrGxABl/v83MgUA)
[Answer]
# [Reticular](https://tio.run/nexus/reticular#@6@vZqWl58Bll5lnla9cYP3/v6GJCQA) / [Befunge-98](https://tio.run/nexus/befunge-98#@6@vZqWl58Bll5lnla9cYP3/v6ERAA), 15 bytes
2D languages!
```
/&:*.@
>in:o#p;
```
## Befunge-98
```
/&:*.@
/          divide top two (no-op)
 &         read decimal input
  :        duplicate
   *       square
    .      output
     @     terminate
```
## Reticular
```
/           mirror up, then right
>in:o#p;
 i          read line of input
  n         cast to number
   :o#      square root
      p     print
       ;    terminate
```
[Answer]
## [QBIC](https://drive.google.com/drive/folders/0B0R1Jgqp8Gg4cVJCZkRkdEthZDQ) / QBasic, ~~26~~ 18 bytes
```
input a
?a^2'^.25
```
In **QBasic**, it takes a number, and prints that number squared. The rest of the code is ignored because QBasic sees it as a comment (`'`).
**QBIC** uses the same input statement. It then goes on to print that same number squared, then raised to the power of a quarter, effectively rooting it twice. This is because `'`is seen as a code literal: Pure QBasic code that is not parsed by QBIC.
[Answer]
## GolfScript/Befunge, 15 bytes
```
#>&:*.@
~2-1??
```
Befunge:
```
#>&:*.@
#>      // jumps over the arrow
  &     // takes an integer as input
   :*   // multiplies the top of the stack by itself
     .  // outputs as integer
      @ // halts
~2-1??  // is not executed
```
GolfScript:
```
#>&:*.@ // is a comment
~2-1??
~       // evaluates the input string
 2-1?   /* calculates 2^-1 = 1/2 (GolfScript does not support non-integers, but
           due to a missed int cast in the interpreter, they can be generated with
           the exponent function */
     ?  // calculates x^1/2 = sqrt(x)
        // the stack is output implicitly
        
```
This is my first golf, please let me know if I'm doing something wrong :)
* Edited to be more portable, thanks to Wzl
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) and [><> (Fish)](https://esolangs.org/wiki/Fish), 10\* bytes
```
<?√,;n*:
```
[Try it in Vyxal (Square root)](https://vyxal.pythonanywhere.com/#WyJBIiwiIiwiPD/iiJosO24qOiIsIiIsIjI1Il0=)
*\*this is 8 bytes in Vyxal but 10 in ><>. I'm scoring them both in UTF-8.*
[Try it in ><> (Square)](https://mousetail.github.io/Fish/#eyJ0ZXh0IjoiPD/iiJosO24qOiIsImlucHV0IjoiIiwic3RhY2siOiI1Iiwic3RhY2tfZm9ybWF0IjoibnVtYmVycyIsImlucHV0X2Zvcm1hdCI6ImNoYXJzIn0=)
# Explanation
What Vyxal sees:
```
<       # less than
 ?      # push input
  √     # sqrt
   ,    # print that sqrt
        # (rest doesn't matter)
```
What ><> sees:
```
<     # point left and wrap around executing the following
 :    # dup
  *   # multiply
   n  # output
    ; # end execution
```
[Answer]
# [Thunno 2](https://github.com/Thunno/Thunno2) and [Vyxal](https://github.com/Vyxal/Vyxal), 4 bytes
[Thunno 2 encoding](https://github.com/Thunno/Thunno2/blob/main/docs/codepage.md):
```
Ẋ,$ƭ
```
[Vyxal encoding](https://github.com/Vyxal/Vyxal/blob/main/vyxal/encoding.py#L3):
```
²,$₃
```
This looks like two different programs, since Thunno 2 and Vyxal have different encodings, but it's really the same sequence of bytes.
[![Screeshot](https://i.stack.imgur.com/V6y5Xm.png)](https://i.stack.imgur.com/V6y5X.png)
(Thunno 2: square root)
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLCsiwk4oKDIiwiIiwiMTAiXQ==) (Vyxal: square)
#### Explanation
```
Ẋ,$ƭ  # Implicit input
Ẋ,    # (No effect)
  $   # Push the input
   ƭ  # Square root
      # Implicit output
²,$₃  # Implicit input
²     # Square the input
 ,    # Print the result
  $₃  # (No effect)
```
[Answer]
## [><>](https://esolangs.org/wiki/Fish) / [Jelly](https://github.com/DennisMitchell/jelly), 9 bytes (7 bytes code + 2 for the '-v' flag in ><>)
Man, I'm really having fun with the Jelly link structure.
```
:*n;
½
```
Calculates the square
[in ><>](https://tio.run/nexus/fish#@2@llWfNdWjv//@W/3XLLAE)
, and the square root
[in Jelly](https://tio.run/nexus/jelly#@2@llWfNdWjv////LQE).
[Answer]
# Python 3 + JavaScript, 101 bytes
```
0//1or exec("function=lambda a:(lambda b:a);x=0")
y=2//2/2
f=(function(x)(x**y))//1 or(lambda x:x**y)
```
Square root in JS, square in Python.
Works on Firefox (tested on FF 52) and requires `(function(x) x)(42) === 42` being valid syntax. Also requires ES7 for the `**` operator.
[Answer]
# macOS Bash and sh, 24 bytes
```
p=^4 :
bc<<<"sqrt($1)$p"
```
On the Mac, `sh` is `bash` running in Posix mode, and in this case as per <https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html>:
> 
> Assignment statements preceding POSIX special builtins persist in the shell environment after the builtin completes
> 
> 
> 
Thus for `sh`, the variable `p` has the value `^4` after the `:` is run, but for `bash`, the variable `p` only has this value while `:` is run, and is empty afterwards.
Being still really `bash` under the covers, some bashisms such as `<<<` herestrings still work for both the bash and sh cases.
---
# Bash and dash (and GNU utils), 27
On Ubuntu 16.01, `sh` is a symlink to `dash`, which doesn't do `<<<` herestrings. So we have this instead:
```
p=^4 :
echo "sqrt($1)$p"|bc
```
[Try it online](https://tio.run/nexus/bash#S04sUbCzUyguLNIrzlCwsVFQd/V3U/9fYBtnomDFlZqcka@gBJQs0VAx1FQpUKpJSv4PVMDFlZQIVA7VZcmFxP4PAA).
[Answer]
# bash and sh, 48 bytes
*Update: I must concede defeat. [Digital Trauma](https://codegolf.stackexchange.com/a/116292/8927)'s bash/sh answer is far more elegant than this one.*
---
```
bc -l<<<"sqrt($1^(($(kill -l|wc -l)*3-3)/7+1))"
```
bash produces `n^2`, sh produces `sqrt(n)`.
---
`bc` is only needed so that `sqrt` can be calculated. The difference in behaviour is between bash and sh.
OK, technically the "sh" I'm using is still bash, but bash in "POSIX" mode (which happens if you invoke `/bin/sh` instead of `/bin/bash` on systems where `/bin/sh` is an alias for bash). If this is the case on your system, you can test with:
```
/bin/bash prog.sh 4
/bin/sh prog.sh 4
```
---
This is based on one of the differences explained here: <https://www.gnu.org/software/bash/manual/html_node/Bash-POSIX-Mode.html>
[Answer]
# [Python 3](https://docs.python.org/3/) and [Python 2](https://docs.python.org/2/), 18 bytes
I took inspiration from [this answer](https://codegolf.stackexchange.com/a/116162/103772)
```
(1/2or 2).__rpow__
```
### Python 3 : [Try it online!](https://tio.run/##K6gsycjPM/6fZhvzX8NQ3yi/SMFIUy8@vqggvzw@/n9BUWZeiYZScWFRiYaxpoKtko5CGpChyYUsYWgGkwGyNP8DAA "Python 3 – Try It Online")
`1/2` is evaluated to `0.5` so `1/2or 2` is equal to `0.5` => sqrt
### Python 2 : [Try it online!](https://tio.run/##K6gsycjPM/qfZhvzX8NQ3yi/SMFIUy8@vqggvzw@/n9BUWZeiYKScZyRgq2SjkKahrEmF1TM0AwuaGim@R8A "Python 2 – Try It Online")
`1/2` is evaluated to `0` so `1/2or 2` is equal to `2` => ^2
]