Temperature Fan Control PWM Arduino Help!

Dr_Ugi:
tempc = tempc/8.0; // better precision

You are doing floating point maths (using 8.0) on an integer variable. I haven't checked but I reckon this may be your issue.

Try defining tempc as a float & see if it works any better.
Better might be:

tempc=tempc>>3;

or for closer rounding:

tempc=((tempc+4)>>3)

Also, why not put a delay at then end of the setup function just to check that the fan runs OK at full speed before moving into the loop. If it doesn't then it sounds like a hardware issue.

thanks for the hint but temperature statements works fine and i have changed the value 8.0 to 8 this is just dividing the 8 samples by 8 its just to get better measurements.