Created
March 1, 2022 13:35
-
-
Save SiddharthManthan/188bae6fd6ab1ca35f7b9c24fdf27de7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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