please help to print series as well sum of series like 1*3-3*5+5*7 up to n terms i have used code like this in php
class series {
function ser(){
$i = 0;
$k = 3;
$m = 0;
for($j = 1; $j < 3; $j++) {
if($j % 2 == 0 ) {
$m = $i + ($i * $k);
} else {
$m=$m-($i*$k);
}
}
//$m = $m + $i;
echo "$m";
}
}
$se = new series();
$se->ser();
Just i have tested for 2 times