Well, assuming that whatever values the histogram is illustrating is stored in an array, one way would be to run through the array finding the element with the highest count. Then once you have that number, you can start printing your histogram. Compare the high count with each of the values in the other array elements, and if their value is greater than (on the first run it won't be) or equal to the high count, print an asterisk - otherwise print a space. That will give you the 'top' line of the histogram. Then you want to decrement the high count that you obtained at the start, and do the test again.
Sorry about the poor pseudo-code - some of the guys on here can do a really nice job of it. Hopefully you get the idea though
find the element with the highest_value
while it is not equal to 0
check against each array element
is the array element greater than or equal to highest_value?
if yes, print an asterisk
if no, print a space
By the way, that is just one way to do it - there are more complicated versions, so put on your thinking cap and see what you can come up with.