Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
21
Task/Multiplication-tables/Jsish/multiplication-tables.jsish
Normal file
21
Task/Multiplication-tables/Jsish/multiplication-tables.jsish
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* Multiplication tables, is Jsish */
|
||||
var m, n, tableSize = 12;
|
||||
|
||||
if (console.args.length > 0) tableSize = parseInt(console.args[0]);
|
||||
if (tableSize < 1 || tableSize > 20) tableSize = 12;
|
||||
|
||||
var width = String(tableSize * tableSize).length;
|
||||
var spaces = ' '.repeat(width+1);
|
||||
|
||||
printf(spaces);
|
||||
for (m = 1; m <= tableSize; m++) printf(' %*d', width, m);
|
||||
printf('\n' + ' '.repeat(width) + '+');
|
||||
printf('-'.repeat((width+1) * tableSize));
|
||||
for (m = 1; m <= tableSize; m++) {
|
||||
printf('\n%*d|', width, m);
|
||||
for (n = m; n < m; n++) printf(spaces);
|
||||
for (n = 1; n <= tableSize; n++) {
|
||||
if (m <= n) printf(' %*d', width, m * n); else printf(spaces);
|
||||
}
|
||||
}
|
||||
printf('\n');
|
||||
Loading…
Add table
Add a link
Reference in a new issue