I see the line, and I can hazard an educated guess.  Every pixel in that line has the same x and y coordinate, assuming it's drawing from the top left.  To pick the x coordinate off a one-dimensional array, you need to use modulo, not division.
Quick example (Java format because that's what I develop in usually):
array px;
for (int i = 0; i < px.length(); i++)
{
    drawPixel((i % px.length()),(i / px.length()));
}