Advertisement
sazid_iiuc

Untitled

Feb 17th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int  n, bin_arr[400], i=0;
  7.     cin>>n;
  8.     while (n>0)
  9.     {
  10.        
  11.         bin_arr[i]=n%2;
  12.         n=n/2;
  13.         i++;
  14.     }
  15.     for (int j = i-1; j >= 0; j--)
  16.     {
  17.         cout<<bin_arr[j];
  18.     }
  19.    
  20.    
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement