Comments on Create a range grid
Parent
Create a range grid
This challenge is based on the i. verb from J.
A range grid is basically a range of m × n numbers fit into a rectangular grid with m rows and n columns.
A 2×3 range grid would be:
0 1 2
3 4 5
Challenge
Generate a range grid, given m and n. You can display it, or return an array.
This is code-golf. Shortest answer in each language wins.
Ruby, 33 bytes ``` ->n,m{[(0 …
4y ago
BQN (CBQN), 10 bytes Anonymou …
4y ago
C (gcc), 59 bytes ``` C i; …
4y ago
[Python 2], 46 bytes …
4y ago
[Python 3], 49 bytes …
4y ago
Japt `-m`, 4 bytes VÆT° …
4y ago
MATL, 8 bytes ``` tp:qwPe! …
4y ago
Lua 5.4, 76 bytes ``` lua …
4y ago
Post
C (gcc), 59 bytes
i;f(m,n){while(i<m*n){putchar(i%n?32:13);putchar(48+i++);}}
-
mis the number of rows. -
nis the number of columns.

1 comment thread