FIND YOUR NEXT FEW LINES

Results for “number”

Small, practical examples. Search by task or narrow things down below.

183 snippets foundClear filters
Linux CommandsDates & process utilities

Format a zero-padded numeric label

Linux Commands: Use printf formatting instead of concatenating a variable number of zeroes.

Linux Commands✓ Tested
C++Numbers & algorithms

Format decimal output

Use fixed and setprecision to print two C++ decimal places.

C++✓ Tested
Arduino / CGetting Started

Give an LED pin a constant name

Arduino / C: Use const to name the built-in LED pin and reuse it in output instructions.

Arduino / C✓ Tested
SQLSubqueries & ranked selection

Include every row tied for the highest score

SQL: Compare with MAX rather than limiting to an arbitrary number of rows.

SQL✓ Tested
SQL ServerSubqueries & ranked selection

Include every row tied for the highest score

SQL Server: Compare with MAX rather than limiting to an arbitrary number of rows.

SQL Server✓ Tested
PostgresSubqueries & ranked selection

Include every row tied for the highest score

Postgres: Compare with MAX rather than limiting to an arbitrary number of rows.

Postgres✓ Tested
SQLiteSubqueries & ranked selection

Include every row tied for the highest score

SQLite: Compare with MAX rather than limiting to an arbitrary number of rows.

SQLite✓ Tested
JavaScriptStrings

Pad a numeric label

Convert a number to text and pad it to a fixed width.

JavaScript✓ Tested
JavaNumbers & dates

Parse an integer safely

Handle invalid Java integer input with NumberFormatException.

Java✓ Tested
CNumbers & memory

Parse an integer with validation

Validate range and trailing characters when parsing a C integer with strtol.

C✓ Tested
Arduino / CSerial communication

Print a floating-point value with fixed precision

Choose the number of decimal places in serial output.

float✓ Tested
Linux CommandsStreams & byte tools

Read a byte prefix

Linux Commands: Use GNU head -c for a fixed number of bytes, independent of line boundaries.

Linux Commands✓ Tested