Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

added 32 characters in body
Source Link
user85052
user85052

CJam, 9 bytes

CJam has mQ, but unfortunately it trunctuates to an integer ... Another port of Lyxal's answer.

q~2 .5#/i

Try it online!

Explanation

q~ e# Take input & evaluate
 2 e# Take 2 to the power of ...
 .5# e# ... 0.5 (equal to square root)
 / e# Divide the input by it
 i e# Convert to integer

CJam, 9 bytes

CJam has mQ, but unfortunately it trunctuates to an integer ...

q~2 .5#/i

Try it online!

Explanation

q~ e# Take input & evaluate
 2 e# Take 2 to the power of ...
 .5# e# ... 0.5 (equal to square root)
 / e# Divide the input by it
 i e# Convert to integer

CJam, 9 bytes

CJam has mQ, but unfortunately it trunctuates to an integer ... Another port of Lyxal's answer.

q~2 .5#/i

Try it online!

Explanation

q~ e# Take input & evaluate
 2 e# Take 2 to the power of ...
 .5# e# ... 0.5 (equal to square root)
 / e# Divide the input by it
 i e# Convert to integer
Source Link
user85052
user85052

CJam, 9 bytes

CJam has mQ, but unfortunately it trunctuates to an integer ...

q~2 .5#/i

Try it online!

Explanation

q~ e# Take input & evaluate
 2 e# Take 2 to the power of ...
 .5# e# ... 0.5 (equal to square root)
 / e# Divide the input by it
 i e# Convert to integer

AltStyle によって変換されたページ (->オリジナル) /