Skip to content

Instantly share code, notes, and snippets.

@SiddharthManthan
Created March 1, 2022 13:35
Show Gist options
  • Save SiddharthManthan/188bae6fd6ab1ca35f7b9c24fdf27de7 to your computer and use it in GitHub Desktop.
Save SiddharthManthan/188bae6fd6ab1ca35f7b9c24fdf27de7 to your computer and use it in GitHub Desktop.
#include <iostream>
void decimalToBinary(int n)
{
while (n != 0)
{
std::cout << n % 2;
n = n / 2;
}
}
int main()
{
int number{ 0 };
std::cout << "Enter a number : ";
std::cin >> number;
decimalToBinary(number);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment