Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
A short and easy STL solution to problem in C++.
  • Loading branch information
hg398 committed Oct 26, 2018
1 parent 1571300 commit f24d1e4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Algorithms/STL binary representation.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

// BY hg398

#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define boost ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define FOR(i,a,b) for(int i=a;i<=b;i++)

int main() {
boost;
int num;
cin>>num; //input number
bitset <64> bit_rep=num; //bitset to convert number into binary representation
for(int i=63;i>=0;i--)cout<<bit_rep[i]; //printing binary representation
return 0;
}

0 comments on commit f24d1e4

Please sign in to comment.