Last active
August 29, 2015 14:07
-
-
Save masious/a6a628302f7793694199 to your computer and use it in GitHub Desktop.
DS Questions - Question 2 - C++
This file contains 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> | |
using namespace std; | |
long long binaryOf(int a){ | |
return a?binaryOf(a/2)*10 + a%2:0; | |
} | |
int main(){ | |
int a; | |
cin>>a; | |
cout<<binaryOf(a); | |
cout<<endl<<"Press any key to continue..."<<endl; | |
getchar(); | |
getchar(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment