kleine ein mal eins in tabelle

Zeigt das kleine Einmaleins in einer Tabelle an, sodass man alle Ergebnisse sofort sehen kann. Erzeugt mit PHP

Der hier verwendete Code

<!DOCTYPE html> <html lang="de"> <head> <meta charset="utf-8"> <title>Einsendeaufgabe 1 "Das 1 mal 1"</title> <style> table,td, th { border: 1px solid #000000; border-collapse: collapse; } td, th { padding: 5px; text-align: right; } </style> </head> <body> <h1>Das kleine 1 mal 1</h1> <table> <tr> <th>*</th> <?php for($i=1; $i <=10; $i++) echo "\t<th>$i</th>\n"; echo " </tr>"; for($i=1; $i <=10; $i++){ echo "\n <tr>\n"; echo "\t\t<th>$i</th>\n"; for($j=1; $j <=10; $j++) printf("\t\t<td>%d</td>\n", $i * $j); echo " </tr>"; } ?> </table>; <?php echo '<table cellpadding="5" border="1">'; echo '<tr>'; echo '<th>*</th>'; for($spalte=0; $spalte <10; $spalte++) { echo sprintf('<th>%d</th>', $spalte+1); } echo '</tr>'; for($reihe=1; $reihe <=10; $reihe++) { echo '<tr>'; echo sprintf('<th>%d</th>', $reihe); for($spalte=1; $spalte <=10; $spalte++) { echo sprintf('<td>%d</td>', $reihe * $spalte); } echo '</tr>'; } echo '</table>'; ?> </body> </html>