If a bear doesn't find abundant food, it will move on. There are no definite rules about what to do if you meet a bear. In almost all cases, the bear will detect you first and will leave the area. Bear attacks are rare compared to the number of close encounters. However, if you do meet a bear before it has had time to leave an are, here are some suggestions.
Every situation is different with respect to the bear, the terrain, the people and their activity.
If you see a bear and it hasn't seen you, calmly leave the area. As you move away, talk aloud to let the bear discover your presence. Back away slowly while facing the bear. Avoid direct eye contact as bears may perceive this as a threat. Give the bear plenty of room to escape.