Fifty Shades of Grey
Mathematica, 30 bytes
Here is another Mathematica approach:
ArrayPlot[#+5#2&~Array~{5,10}]
or
ArrayPlot[5#+#2&~Array~{10,5}]
The first one simply creates an array
{{6, 11, 16, 21, 26, 31, 36, 41, 46, 51},
{7, 12, 17, 22, 27, 32, 37, 42, 47, 52},
{8, 13, 18, 23, 28, 33, 38, 43, 48, 53},
{9, 14, 19, 24, 29, 34, 39, 44, 49, 54},
{10, 15, 20, 25, 30, 35, 40, 45, 50, 55}}
and the second one
{{6, 7, 8, 9, 10},
{11, 12, 13, 14, 15},
{16, 17, 18, 19, 20},
{21, 22, 23, 24, 25},
{26, 27, 28, 29, 30},
{31, 32, 33, 34, 35},
{36, 37, 38, 39, 40},
{41, 42, 43, 44, 45},
{46, 47, 48, 49, 50},
{51, 52, 53, 54, 55}}
Then, ArrayPlot
plots them as a grid and, by default, uses greyscale to visualise the values.
CJam - 23 (no actual graphical output)
Since CJam can't draw on the screen (yet?), I wrote a program that outputs an image in plain pgm format.
Save the output to a file called 50.pgm and open with an image viewer/editor.
"P2"1e3K51_,1>K*$K*~]N*
Try it online
The result looks like this:
Explanation:
"P2" push "P2" (netpbm magic number)
1e3K push 1000 and K=20 (image size)
51 push 51 (value of white)
_, duplicate 51 and convert to an array [0 1 2 ... 50]
1> remove 0 (slice from 1)
K* repeat the array 20 times
$ sort, to get [(20 1's) (20 2's) ... (20 50's)]
K* repeat the array 20 times
~ dump the elements on the stack
] put everything from the stack in an array
N* join with newlines
Mathematica 72 61 59 43 35 34 bytes
Current version (34 bytes)
GrayLevel[#/50]~Style~50 &~Array~50
Earlier version (59 bytes), thanks to Martin Büttner.
Graphics[{GrayLevel[#/50],Cuboid@{#~Mod~9,#/9}}&/@Range@50]
Blue borders added to highlight position of squares.
Graphics[{EdgeForm[Blue], GrayLevel[#/50], Cuboid@{#~Mod~9, #/9}} & /@Range@50]
Number of squares:
Length[%[[1]]]
50
First attempt (72 bytes)
If the squares can overlap. As Zgarb notes, there is a remote possibility that one square would hide another.
Graphics@Table[{GrayLevel@k,Cuboid[{0,15}~RandomReal~2]},{k,.4,.89,.01}]