/*
正整数的进制转换,以下程序为10进制转换为2进制
*/
#include <stdio.h>
#include <stdlib.h>
typedef struct Node* Stack;
struct Node
{
int element;
struct Node* Next;
};
void Init(Stack S)
{
S->Next = NULL;
}
void Push(Stack S, int e)
{
Stack t = (Stack)malloc(sizeof(struct Node));
t->element = e;
t->Next = S->Next;
S->Next = t;
}
int Pop(Stack S)
{
Stack t = S->Next;
int x = t->element;
S->Next = S->Next->Next;
free(t);
return x;
}
int main(void)
{
int n;
Stack S = (Stack)malloc(sizeof(struct Node));
Init(S);
scanf("%d", &n);
while (n)
{
Push(S, n % 2);
n /= 2;
}
while (S->Next!=NULL)
{
int x = Pop(S);
printf("%d", x);
}
printf("\n");
return 0;
}