In all cases, do your very best not to show fear. Never run or make sudden movements. A surprised bear at close range will be as nervous as you are, and running or jerking your head or arms may convince the bear to chase you. It is not possible to outrun a bear. The bear will use all of its senses in an effort to figure out who or what you are.
Bears possess poor vision and, as mentioned earlier, a keen sense of smell.
It is not uncommon for a bear in this situation to come in your direction a short distance, then stand up on its hind legs. Don't turn and flee. Continue with the steps above. Upon figuring out you're a human, the bear in many cases will drop back onto all fours and amble off. If the bear charges.