Very Simple Grid Marks

J, 9 5 bytes

$":&1

Uses spaces and 1's and expects input in the form H W f N

Explanation:

$":&1
   &1 bonds the fixed right argument 1 to ":
 ":   formats the right argument number (1) to take up left argument (N) number of cells
      padding with spaces, resulting  in "  1"
$     reshape to H-by-W with repeating the string if necessary 

Usage:

   3 7 ($":&1) 3
  1  1 
 1  1  
1  1  1

Try it online here.


Python 2, 60 bytes

w,h,n=input()
s='%%%dd'%n%0*w*h
exec"print s[:w];s=s[w:];"*h

This prints space and 0 in place of . and X. Input is taken as a tuple in the form of w,h,n.


J, 12 bytes

$'X'_1}#&'.'

This is a dyadic function that takes the array H W as its left argument and N as its right argument. Usage:

  f =: $'X'_1}#&'.'
  3 5 f 3
..X..
X..X.
.X..X

Explanation

$'X'_1}#&'.'
         '.'  The character '.'
       #&     repeated N times
    _1}       with the last character
 'X'          replaced by 'X'
$             reshaped into an HxW array