Nikon D50 Camera problem?

My Nikon D50 doesn't work in auto-mode, i mean when i press to make a picture in auto mode the Lensis making a few moves and takes a very bblurrypicture, it doesn't focus, what could be the problem, lLens, camera or something in settings?
Added (1). Its an AF-S NIKKOR 18-55 mm
Added (2). And if the problem is in the Camera motor, how much it will cost to repair it?

It could be a problem with the lens or the camera. It would help if you can try the camera with another lens and the lens with another camera. The D50 has its own autofocus motor, so it should be able to autofocus with AF-D lenses as well as with AF-S lenses. With AF-S lenses the lens is providing the autofocus motor. The camera links to it electronically but not mechanically. So you want to pay attention what kind of lens is dysfunctional or not with the camera. If more than one AF-D lens is troublesome but an AF-S lens works well, then it is probably the camera's motor or link that is a problem. If AF-S lenses are dysfunctional with this body, then it could be an electronic issue.
There's an AF/M switch on the camera body, and you should check that it isn't in an intermediate position.

A problem in the camera motor would mean an economical writeoff. Since you're using an AF-S lens that will not be it. See if you can get a sharp picture if you switch lens and body to manual focus.
I strongly suspect the lens suffered physical damage (dropping or hitting it can do that) and that with a new lens it will be fine. A gently used 18-55 can be had for $75 easily