I'm guessing the assignment deadline has passed, so for the sake of others reading the thread, here's one solution...
<?php
$a = 1;
$b = 2;
$c = [];
$d = [];
$N = 8;
$tdata1 = $tdata2 = "";
$vals = [];
for ($i=1, $a=1, $b=2; $i<=$N; $i++, $a+=2, $b+=2) {
$c[] = $a;
$d[] = $b;
$exp = '<u>' . join('.', $c) . "</u><br>" . join('.', $d);
$tdata1 .= "<td>$exp</td>";
$val = number_format(array_product($c) / array_product($d), 5) ;
$tdata2 .= "<td>$val</td>";
}
?>
<table border='1'>
<tr><th>Fraction</th>
<?=$tdata1?>
</tr>
<tr><th>Decimal</th>
<?=$tdata2?>
</tr>
</table>