bc · online compiler

Run bc online

bc arbitrary-precision calculator, online. Sandboxed, no install.

Available versions
Firecracker microVM live per-test verdicts multi-file compile

bc is the venerable arbitrary-precision calculator on every Unix system. Set the scale, do 1000-digit factorials, script piecewise functions — it holds up.

ls-judge runs GNU bc inside a per-submission microVM. Pipe expressions in via stdin, get results streamed back.

Starter code

What you get in bc

Clicking "Run now" opens the playground with this exact code and a matching test case pre-loaded — passes on first Run.

bc
bc 1.18
n = read()
print n * 2, "\n"
halt
stdin →21
expected →42
FAQ

Common questions about bc on ls-judge

Is it POSIX bc or GNU bc?
GNU bc, which is a superset of POSIX bc (extra syntax like read(), print, else).
Can I use dc?
Yes, we have a separate /lang/dc page for the RPN sibling.
What is the scale default?
scale=0 by default. Set explicitly at the top of your input for the precision you need.
Is this free?
Yes, unlimited within the free-tier rate limit (10 req/min anonymous, 30/min signed-in).
Further reading
Also try