Created
June 13, 2021 17:55
-
-
Save jeffersonchaves/fcbea93c003ef0d67897b982ec62753d 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
<?php | |
$lista = [30]; | |
$count = 0; | |
for ($i = 0; $i < 30; $i++) { | |
$lista[] = rand(1, 15); | |
} | |
print "Digite um numero: "; | |
$chave = (int) fgets(STDIN); | |
for ($i = 0; $i < 30; $i++) { | |
if ($lista[$i] == $chave) { | |
print "o numero escolhido foi encontrado na posicao: " . $i . "\n"; | |
$count++; | |
} | |
} | |
print "o valor procurado foi encontrado $count vezes."; | |
//exercucio 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment