table of numbers

1

I have a program that prints odd even numbers and multiples of fifths but I take care that the result is looked like this in columns downwards I print linear

10     2        3        1
9      4        5        5
8      8        7       10
7     10        9       15

This is the code

<?php

$i=1;
$sucesivo=11-$i;
$pares=$i * 2;
$impares=$i * 2 - 1;
$quintos=$i * 5 -5;

while($i<=10){

    echo $i++,$sucesivo,$pares,$impares,$quintos;
}


?>

This throws me:

1102102102103102104102105102106102107102108102109102101010210
    
asked by wdwd 05.10.2017 в 09:39
source

1 answer

0

You have to print the line break at the end of echo :

echo $i++,$sucesivo,$pares,$impares,$quintos,"\n";

If you want to put spaces between each parameter then you can add a tab:

echo $i++,"\t",$sucesivo,"\t",$pares,"\t",$impares,"\t",$quintos,"\n";
    
answered by 05.10.2017 / 09:48
source