Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Project516/c-calc/llms.txt

Use this file to discover all available pages before exploring further.

c-calc is a lightweight command-line calculator written in C. It takes two numbers and one operator, computes the result, and prints it — nothing more. This page explains what c-calc is, what it supports, and how to get started.

What c-calc does

c-calc performs arithmetic on two operands using a single binary operator. Results are always printed with four decimal places:
Result: 2.0000
It is built from a single make command and has no runtime dependencies beyond the C standard library.

Supported operators

c-calc supports five arithmetic operators:
OperatorOperationExample
+Addition1 + 23.0000
-Subtraction5 - 32.0000
*Multiplication4 * 312.0000
/Division9 / 24.5000
%Modulo7 % 31.0000
Division by zero is handled gracefully — c-calc prints an error message instead of crashing.

Two modes of operation

c-calc runs in two modes depending on how you invoke it. Interactive mode — run ./c-calc with no arguments. c-calc prompts you for the first number, the operator, and the second number one at a time. Non-interactive mode — pass all three arguments on the command line. Useful for scripting or one-off calculations without prompts.
Use non-interactive mode in shell scripts to avoid interactive prompts and capture the output directly.

License

c-calc is released under the AGPL-3.0 license.

Next steps

Install c-calc

Install GCC and build c-calc from source on Linux, macOS, or Windows.

Quickstart

Run your first calculation in under a minute.

Build docs developers (and LLMs) love