Advertisement
Gireada

SOC

Mar 3rd, 2017
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, nr[9],i = 0;
  8.     cin>>n;
  9.     while(n != 0)
  10.     {
  11.         nr[i] = n%2;
  12.         i++;
  13.         n = n/2;
  14.     }
  15.     for(int j = i-1; j >= 0; j--)
  16.         cout<<nr[j];
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement