Untitled
unknown
plain_text
a year ago
530 B
7
Indexable
#include "../testee/teste.h"
#include <stdio.h>
void convertBin(int n){
int quoc, resto;
Stack pilha;
inicialize(&pilha);
while(n != 0){
quoc = n / 2;
resto = n % 2;
if(isFull(pilha) == 0){
push(&pilha, resto);
} else{ return; }
n = quoc;
}
while(isEmpty(pilha) == 0){
printf("%d", pop(&pilha));
}
printf("\n");
}
int main(){
int num;
scanf("%d", &num);
convertBin(num);
return 0;
}Editor is loading...
Leave a Comment