Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- algoritmo "4_51"
- declare n:inteiro;
- declare s:real;
- declare t, aux, r:inteiro;
- enquanto (n != -1) faca
- escreval("Informe o número na base 3: ");
- leia(n);
- r <- 0;
- s <- 0;
- t <- 0;
- aux <- n;
- se (n != - 1) entao
- enquanto (aux != 0) faca
- r <- (resto(aux,10));
- s <- s + (r * potencia(3, t));
- t <- t + 1;
- aux <- aux/10;
- fimenquanto
- escreval(s);
- fimse
- fimenquanto
- fimalgoritmo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement