I have to resolve this exercice : Display all the numbers in descending order between 0 and 100, then display hurray each prime number between 100 and zero within the same loop that displays the decreasing eveners.
I did this code :
for($n=100; $n>0; $n-=1 ){
$tableaunombrepaires[]= $n;
//loop for dividers
for($j=2; $j<=$n/2; $j++) {
$diviseurs[]= $j;
}
// here we devide
foreach($diviseurs as $diviseur){
$restes[]=$n%$diviseur;
}
if(!(in_array(0,$restes))){
echo "$n hourrah! \n";
}
else{
echo "$n \n";
}
}
but it doesn't work help please