Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- void function(int a) {
- int n = 0;
- int k,m = 0;
- while(a) {
- k = a % 2;
- a = a / 2;
- n += k * pow(10, m);
- m++;
- }
- cout << n << endl;
- }
- int main()
- {
- int a;
- cin >> a;
- function(a);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement