
Voob
5 год назад
составить программу которая печатает таблицу умножения в php
ОТВЕТЫ

Todorka
Oct 24, 2020
$rows = 20;
$cols = 20;
$table = '<table border="1">';
for ($tr=1; $tr<=$rows; $tr++){
$table .= '<tr>';
for ($td=1; $td<=$cols; $td++){
if ($tr===1 or $td===1){
$table .= '<th style="color:white;background-color:blue;">'. $tr*$td .'</th>';
}else{
$table .= '<td>'. $tr*$td .'</td>';
}
}
$table .= '</tr>';
}
$table .= '</table>';
echo $table;
$cols = 20;
$table = '<table border="1">';
for ($tr=1; $tr<=$rows; $tr++){
$table .= '<tr>';
for ($td=1; $td<=$cols; $td++){
if ($tr===1 or $td===1){
$table .= '<th style="color:white;background-color:blue;">'. $tr*$td .'</th>';
}else{
$table .= '<td>'. $tr*$td .'</td>';
}
}
$table .= '</tr>';
}
$table .= '</table>';
echo $table;
276
Смежные вопросы: