Created
August 11, 2023 17:19
-
-
Save jeffersonchaves/4da98a29dd2c9d10a53105f01d3e69af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
programa | |
{ | |
inclua biblioteca Util | |
funcao inicio() | |
{ | |
inteiro lista[30] | |
inteiro num_elementos = Util.numero_elementos(lista) | |
inteiro contador = 0 | |
inteiro chute | |
enquanto(contador < num_elementos){ | |
lista[contador] = Util.sorteia(1, 15) | |
contador++ | |
} | |
escreva("Informe seu chute: ") | |
leia(chute) | |
//algoritmo de busca | |
para(inteiro i=0; i < num_elementos; i++){ | |
se(chute == lista[i]){ | |
escreva("valor encontrado na posicao: ", i, "\n") | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment