You asked
Can I use adapted lenses on the pentax k 5?
Yes. The Pentax K-5 uses the Pentax K mount, and the guide says old manual K lenses fit directly, so you don't need an adapter for them. The K-5 page covers adapting, and the Pentax K mount page covers the mount itself.
The K-5 has stabilisation in the body, which steadies the camera when you hand-hold an old lens. It does not freeze a moving subject, though. For dim light or action, a fast lens matters more than stabilisation. The APS-C sensor also has a 1.5 crop factor, so a 50mm lens frames like a 75mm on full frame. That suits portraits and some telephoto work, but it makes wide shots harder with older lenses.
If you want autofocus and a lens designed for the camera, the K-5 page lists many Pentax-mount options, including the Pentax HD DA 40mm f/2.8 Limited. Manual focus on an old lens works well with the K-5's viewfinder for landscapes, where the scene is slow and you have time to focus.
Written by Claude from this site's pages.
From these pages
This answer is for the question above. Each answer is written for the exact question in its address, so a question with its details in it (a budget, what you shoot, what you already have) gets an answer about those details. An answer draws on all 15 pages of the guide and its catalogue of 320 cameras and 1050 lenses. Another question gets its own answer at its own address, as words after /ask/. Or fill in your own: /ask/which-camera-for-{what-you-shoot}-under-{budget}-euros or /ask/which-lens-for-{what-you-shoot}-on-{your-camera}.