#include<iostream.h>

struct stack{

      int info[16];

      int top;};//STACK

      void push(stack &mystack, int x){

            mystack.info[mystack.top]=x;

            mystack.top=mystack.top+1;}//PUSH

      int pop(stack &mystack){

            mystack.top=mystack.top-1;

            return mystack.info[mystack.top];}//POP

      int isempty(stack &mystack){

            if(mystack.top==0) return 1;

            else return 0;}//ISEMPTY

      void main(){

            int rem;

            stack mystack;

            mystack.top=0;

            int number;

            cout<<"ENTER A NUMBER\n";

            cin>>number;

            while(number!=0){

                  rem=number%2;

                  push(mystack, rem);

                  number=number/2;}//WHILE

            while(!isempty(mystack)){

                  cout<<pop(mystack)<<" ";}//WHILE

      }//MAIN

1