Hi. I am fairly new to Arduino. I have a circuit done were I am reading two DS18B20 sensors an displaying them to an LCD. I have recently added a relay to turn it on/off @ a certain temperature and it's working fine. But i want to add to this. My problem is i have a lot of scenarios. My question is how would I write a code for the following scenario.

If Temp1 Is greater than 15.5

Relay should be always off

If Temp1 Is less than 15.5 and greater than 14.5 and Temp 2 is greater than 44

Relay should be off

If Temp1 Is less than 15.5 and greater than 14.5 and Temp 2 is less than 40

Relay should be on

If Temp1 Is less than 14.5 and grater than 13.5 and Temp 2 is greater than 48

Relay should be off

If Temp1 Is less than 14.5 and grater than 13.5 and Temp 2 is less than 44

Relay should be on

If Temp1 Is less than 13.5 and grater than 12.5 and Temp 2 is greater than 52

Relay should be off

If Temp1 Is less than 13.5 and grater than 12.5 and Temp 2 is less than 48

Relay should be on

If Temp1 Is less than 12.5 and grater than 11.5 and Temp 2 is greater than 56

Relay should be off

If Temp1 Is less than 12.5 and grater than 11.5 and Temp 2 is less than 52

Relay should be on

If Temp1 Is less than 11.5 and grater than 10.5 and Temp 2 is greater than 60

Relay should be off

If Temp1 Is less than 11.5 and grater than 10.5 and Temp 2 is less than 56

Relay should be on

If Temp1 Is less than 10.5 and grater than 9.5 and Temp 2 is greater than 64

Relay should be off

If Temp1 Is less than 10.5 and grater than 9.5 and Temp 2 is less than 60

Relay should be on

If Temp1 Is less than 9.5 and grater than 8.5 and Temp 2 is greater than 68

Relay should be off

If Temp1 Is less than 9.5 and grater than 9.5 and Temp 2 is less than 64

Relay should be on

If Temp1 Is less than 8.5 and grater than 7.5 and Temp 2 is greater than 72

Relay should be off

If Temp1 Is less than 8.5 and grater than 7.5 and Temp 2 is less than 68

Relay should be on

If Temp1 Is less than 7.5 and grater than 6.5 and Temp 2 is greater than 76

Relay should be off

If Temp1 Is less than 7.5 and grater than 6.5 and Temp 2 is less than 72

Relay should be on

If Temp1 Is less than 6.5 and grater than 5.5 and Temp 2 is greater than 80

Relay should be off

If Temp1 Is less than 6.5 and grater than 5.5 and Temp 2 is less than 76

Relay should be on

If Temp1 Is less than 5.5 and grater than 4.5 and Temp 2 is greater than 84

Relay should be off

If Temp1 Is less than 5.5 and grater than 4.5 and Temp 2 is less than 80

Relay should be on

If Temp1 Is less than 4.5 and grater than 3.5 and Temp 2 is greater than 88

Relay should be off

If Temp1 Is less than 4.5 and grater than 3.5 and Temp 2 is less than 84

Relay should be on

If Temp1 Is less than 3.5 and grater than 2.5 and Temp 2 is greater than 92

Relay should be off

If Temp1 Is less than 3.5 and grater than 2.5 and Temp 2 is less than 88

Relay should be on

If Temp1 Is less than 2.5 and grater than 1.5 and Temp 2 is greater than 96

Relay should be off

If Temp1 Is less than 2.5 and grater than 1.5 and Temp 2 is less than 92

Relay should be on

If Temp1 Is less than 1.5 and grater than 0.5 and Temp 2 is greater than 100

Relay should be off

If Temp1 Is less than 1.5 and grater than 0.5 and Temp 2 is less than 96

Relay should be on

If Temp1 Is less than 0.5

Relay should be always on