declare(strict_types=1);
function steps(int $number): int{
if($number <=0) throw new InvalidArgumentException('Only positive numbers are allowed');
$counter = 0;
while($number >1){
if($number % 2 ==0){
$number /= 2;
}
else{
$number = 3\*$number+1;
}
$counter +=1;
}
return $counter;
}
Ciao @drago18121996.
Mi incuriosiscono questi tuoi post. Cosa rappresentano questi snippet di codice?
Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below
View or trade
BEER
.Hey @drago18121996, here is a little bit of
BEER
from @isnochys for you. Enjoy it!Do you want to win SOME BEER together with your friends and draw the
BEERKING
.