Temperature controlled fan using Arduino

I need some help on how to write my program for this particular task

Here's a start:

void setup()
{
}

void loop()
{
}

All you need to do is fill in the bit that reads the temperature sensor and sets the fan speed, and sends that value to the fan.

Depending on the fan, you may need to use a transistor between the Arduino and the fan,