FIND YOUR NEXT FEW LINES

Results for “integer”

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

114 snippets foundClear filters
C#Data & dates

Sum integer values

Sum a C# sequence using LINQ.

C#✓ Tested
JavaNumbers & dates

Sum integer values

Reduce a Java integer stream to its sum.

Java✓ Tested
CSmall algorithms & bit operations

Sum the decimal digits of an unsigned integer

C: Repeated division and remainder extract digits without converting to text.

C✓ Tested
CNumbers & memory

Swap two integers

Use a temporary value to swap C integers without arithmetic overflow.

C✓ Tested
C#Strings

Try parsing an integer

Use TryParse to avoid exceptions for invalid C# integer input.

C#✓ Tested
Arduino / CData & storage

Map an input range to an output range

Scale an integer reading to a different interval.

map✓ Tested
Arduino / CData & storage

Average a fixed set of readings

Accumulate sample values without overflowing a 16-bit total.

array✓ Tested
PythonNumbers & calculations

Calculate the number of required pages

Python: Use integer arithmetic to round a nonnegative count up to a positive page size.

Python✓ Tested
C++Tasks & synchronization

Convert a duration to another unit explicitly

C++: duration_cast converts units and truncates fractional integer units.

C++✓ Tested
Arduino / CSensor calculations

Convert Celsius to Fahrenheit

Arduino / C: Use floating-point constants to avoid integer division.

Arduino / C✓ Tested
SQLiteJSON data

Expand a JSON array into rows

Iterate array elements using a table-valued function.

json_each✓ Tested
PythonStrings & dates

Extract numbers from text

Find all runs of ASCII digits in a string and convert the matches to integers.

regex✓ Tested