<?php
$natural = 0;
// verfica entrada para $natural e repete solicitação até ser válido
while ($natural <= 0) {
	echo "Forneça um número natural para saber seus divisores em ordem decrescente: \n";
	fscanf(STDIN, "%d", $natural);
	}
$contador = $natural;
while ($contador > 0) {
	if ($natural % $contador == 0) {
		$divisor = $contador;
		echo $divisor . " é divisor de $natural.\n";
	}
    $contador--;
}
?>

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: