lundi 15 juillet 2019

Write a PHP code to print following number pattern

Write a PHP code to print following number pattern:
147
258
369

I am trying like this but its shows me shows below. how to convert column to row pattern.

<?php
$num = "";
for($i=1;$i<=9;$i++) {

$num .= $i; 
if($i%3==0){
$num .="<br />";
} 

}
echo $num;
?>

please help me

Aucun commentaire:

Enregistrer un commentaire