Advertisement
Guest User

4_51

a guest
Sep 4th, 2018
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. algoritmo "4_51"
  2.  
  3.       declare n:inteiro;
  4.       declare s:real;
  5.       declare t, aux, r:inteiro;
  6.       enquanto (n != -1) faca
  7.                escreval("Informe o número na base 3: ");
  8.                leia(n);
  9.                r <- 0;
  10.                s <- 0;
  11.                t <- 0;
  12.                aux <- n;
  13.                se (n != - 1) entao
  14.                   enquanto (aux != 0) faca
  15.                            r <- (resto(aux,10));
  16.                            s <- s + (r * potencia(3, t));
  17.                            t <- t + 1;
  18.                            aux <- aux/10;
  19.                   fimenquanto
  20.                   escreval(s);
  21.                fimse
  22.       fimenquanto
  23. fimalgoritmo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement