About 34,500 results
Open links in new tab
  1. Printing a number in binary in C - Code Review Stack Exchange

    Jun 10, 2023 · I wrote a short function whose purpose is simple: Print the binary representation of number to the console. I also aim to be as portable as possible, hence my use of CHAR_BIT …

  2. Converting whole numbers to binary in C/C++ - Code Review …

    Nov 21, 2021 · A way to convert a number to binary is to use the mod operator, this thing -> % will give you the remainder of a divide for whole numbers. For example (4%3) will give you a …

  3. Decimal to Binary in Rust - Code Review Stack Exchange

    Jan 6, 2019 · The point of a to_binary function is pretty much always because you for some reason want a textual representation in binary. As a quick side note, Rust already has the …

  4. Convert Integer to Binary String - Code Review Stack Exchange

    Oct 16, 2020 · This code takes a user input number which is a positive integer, and outputs a string representation of the number in binary. For example, input 2 outputs '10' and input 25 …

  5. Converting decimal integer to binary string - Code Review Stack …

    Jun 10, 2016 · For a binary type, that gives you the number of bits in a type, so you don't need to compute the size on your own. Note: this only gives the number of bits that hold the value in a …

  6. Represent integer as binary in C - Code Review Stack Exchange

    Jan 21, 2021 · To practice my C, I've written a small function in C to display an integer as an 8-bit binary number. Please let me know how to improve this function, and other C-style coding …

  7. Unsigned 32-bit integer to binary string function

    Jun 14, 2021 · I've been trying to solidify my understanding of the binary number system by writing code. So, I tried to write a function with what I currently understand about the binary …

  8. Counting the number of consecutive 1's in binary

    Dec 25, 2019 · 17 hackerrank.com Task: Given a base-10 integer, n, convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in n …

  9. "Counter Game" Powers of 2 Game - Code Review Stack Exchange

    Nov 26, 2018 · When the number isn't a power of 2, according to the game you need to remove the next lower power of 2. In binary it's gonna look like removing the left most bit (you can look …

  10. Decibinary for xth number (Python code)

    Aug 10, 2022 · Problem description: Let's combine decimal and binary numbers in a new system we call decibinary! In this number system, each digit ranges from 0 to 9 (like the decimal …