a bike store could tell in a second if your chain is bad.
if not, then its probably the freewheel or freehub depending on the bike.
a freewheel (mostly on older bikes, and some new low end stuff) are $30 or something plus maybe $10 or something to put it on the wheel.
not sure what a replacement freehub costs, if your rear hub even has a replaceable one. shimano hubs probably do, others, maybe.