Simple psuedocode algorithm:
for each column of pixels (starting from the rightmost column, moving left)
for each row
if this pixel is black
return x coordinate of column
I am deliberately leaving specifics out, as this seems to be a homework question and no effort has been shown on your part. But, this should be enough to get you started.