Anything chambered in .375 ruger, .450 marlin, .30-06 and other larger rounds.
For self defense...
If you have the money, nothing beats the hand cannon that is the S&W 500, but similar large handguns will also work (along the lines of 44 mag, 10mm). Some people will go as low as 357 mag and even 9mm, but lower calibers are generally not recommended.
Based on an alaskan friend of mine's advice and lifesaving experience, a .45-70 government rifle puts them down quick and hard. Assuming he wasn't yanking my chain, he stopped a charging brown with a .45-70 slug tearing through it lengthwise. The bear, he tells me, did a nosedive on the spot and that was that.
His specific advice was that he wants a rifle which will split a bear open like a rail. He was definitely a believer in bigger being better.
What kind of bear? black bear, large or small, big brown bear, grizzly?
Rifle or handgun?
For a long gun, seriously, a 12 gauge with slugs is adequate for black bear if you are going to be within reasonable range. Any slug gun can put a round into 3 inches at 50 yards or so. The 3 inch magnum slug is far more powerful than nearly anyone gives it credit for, and it will blow a hole nearly an inch wide all the way through a bear. a rifled slug gun in pump can be had for $400-500. A pump or semiaut rifle can be had for between $500-800, probably. Should you carry a bolt? are you good enough to get a second shot in if the first is bad? Firing at close range at a bear can turn dangerous, a bolt gun isn't the best way to do it, IMO.
a centerfire rifle would work in any 308 or 30-06 class rifle, including .270, or any other cartridge of 120 or so grains loaded to 2,500 or so velocity. again, talking about small to medium bear at normal ranges of point blank out to several hundred yards. Essentially, a small to medium bear gun could be any deer gun, with the limitations (again, IMO,) of minimum .270, 120 grains or so, 2,500 or so, and good, well made expanding bullets. A .308 winchester with 180 grain partition or other good bullet would be ideal for medium range black bear in the eastern or even western american lands.
A bear gun, except for big browns or grizzly does not need to be anything really special. In fact, I saw a bear that was killed with a .357 pistol, 6 rounds, during a charge. It was a life or death call. It's not a good choice, but it can be done.
My personal choice would be a .358 winchester in a semiauto rifle, or pump rifle.
You leave out a lot of information. this is in general a good suggestion for small to medium bear in medium to short range.
OK, I think anyone giving advice on how to deal with Bears should first tell what experience they have had dealing with Bears 🐻 type and situation first, rather than an armchair expert that never fought much less encountered a Bear in the wilds, in person, I spent Summers Upstate New York and it was common to encounter Bears, mostly smaller Brown Bears 🐻 looking for food, and oftentimes run off rather than face people. A Glock 20 is handy on the hip loaded with heavy Buffalo ammo. Most bears will run from gunfire.