RosettaCodeData/Task/Multiplication-tables/Neko/multiplication-tables.neko
2019-09-12 10:33:56 -07:00

42 lines
583 B
Text

/**
Multiplication table, in Neko
Tectonics:
nekoc multiplication-table.neko
neko multiplication-table
*/
var sprintf = $loader.loadprim("std@sprintf", 2);
var i, j;
i = 1;
$print(" X |");
while i < 13 {
$print(sprintf("%4d", i));
i += 1;
}
$print("\n");
$print(" ---+");
i = 1;
while i < 13 {
$print("----");
i += 1;
}
$print("\n");
j = 1;
while j < 13 {
$print(sprintf("%3d", j));
$print(" |");
i = 1;
while i < 13 {
if j > i {
$print(" ");
} else {
$print(sprintf("%4d", i*j));
}
i += 1;
}
$print("\n");
j += 1;
}