Garbage values of sensors

I am doing a project on pir sensor induced fan and lighting. I am using a lm35 sensor and ldr also. The problem which I am facing is that lm35 and ldr reads unbelievable values such as 312degrees and 1023. How to debug this?

Please, give a little information:

Hardware sketch

Software excerpt (or complete, if less than, say, 20 lines)


You need to post a digram of how everything is connected and your code.

LM35 issue: looks like a coding error. Post your sketch (all of it - snippets are generally useless - if too long create a smallest possible sketch that demonstrates the problem).
LDR issue: looks like a wiring error. Post your circuit diagram (no Fritzing wire spaghetti, but a proper circuit diagram).