Intelligent High Beam code

So my homework assignment has been to create a code that shows how high beams work and so i created this code and I feel like everything is correct but I keep getting this error message of "exit status 1: 'else' without a previous 'if'". I would really appreciate the help, thanks!

#include<Stepper.h>

int fogLED = 5;
int highLED = 6;
int headLED = 7;
int trigPin = 2;
int echoPin = 3;
int SWPot = A0;
int headPot = A1;
int photoSensor = A2;

int STEPS_PER_MOTOR_REVOLUTION = 32;
Stepper small_stepper(STEPS_PER_MOTOR_REVOLUTION, 8,10,9,11);

int step_current = 0; // current step of the motor
int steps_to_take = 0; // steps the stepper motor should take

void setup()
{
Serial.begin(9600); //enable serial debug
pinMode(fogLED,OUTPUT);
pinMode(highLED,OUTPUT);
pinMode(headLED,OUTPUT);
pinMode(trigPin,OUTPUT);
pinMode(echoPin,INPUT);

small_stepper.setSpeed(700);
}

void loop()
{
int swpotVal = analogRead(A0);
int headVal = analogRead(A1);
int photoVal = analogRead(A2);
Serial.print(A0);
Serial.println(swpotVal);
Serial.print(A1);
Serial.println(headVal);
Serial.print(A2);
Serial.println(photoVal);
float cm;

if (headVal <= 250); // off
{
digitalWrite(fogLED,LOW);
digitalWrite(headLED,LOW);
digitalWrite(highLED,LOW);
steps_to_take = 0;
}
else if (headVal <= 500) // fog
{
digitalWrite(fogLED,HIGH);
digitalWrite(headLED,LOW);
digitalWrite(highLED,LOW);
steps_to_take = 0;
}
else if(headVal <= 750) // headlight + rotaation
{
digitalWrite(fogLED,HIGH);
digitalWrite(headLED,HIGH);
digitalWrite(highLED,LOW);
steps_to_take = (511 - swpotVal)*15/511;
}
else // auto
{
if(photoVal >= 900)// bright
{
digitalWrite(fogLED,LOW);
digitalWrite(headLED,LOW);
digitalWrite(highLED,LOW);
steps_to_take = 0;
}
else if (photoVal >= 750) // dim
{
digitalWrite(fogLED,HIGH);
digitalWrite(headLED,HIGH);
digitalWrite(highLED,LOW);
steps_to_take = (511 - swpotVal)*15/511;
}
else // dark
{
digitalWrite(trigPin,LOW);
delayMicroseconds(2);
digitalWrite(trigPin,HIGH);
delayMicroseconds(10);
digitalWrite(trigPin,LOW);

cm = pulseIn(echoPin,HIGH)/58.0; // Echo time conversion into cm
cm = (int(cm*100.0))/100.0; // Keep two decimal places

if (cm > 20);
{
digitalWrite(fogLED,LOW);
digitalWrite(headLED,LOW);
digitalWrite(highLED,HIGH);
}
else
{
digitalWrite(fogLED,LOW);
digitalWrite(headLED,LOW);
digitalWrite(highLED,LOW);
}
digitalWrite(fogLED,HIGH);
digitalWrite(headLED,HIGH);
digitalWrite(highLED,LOW);
steps_to_take = (511 - swpotVal)*15/511;
}
}
if(step_current<steps_to_take)
{
small_stepper.step(10);
step_current++ ;
}
else if(step_current>steps_to_take)
{
small_stepper.step(-10);
step_current--;
}
delay(30);
} // end of loop forever function

There is something on this line that should not be there:

 if (cm > 20);

You've done it further up too.

Serial.print(A0); Why?

Make it easier for others to help you...

use CODE TAGS and ensure your formatting/indenting is consistent...
if you do,that, often you’ll see your own errors before you post here !

The stray ';' at the end of the 'if' line is the only thing in the 'if'. The block after that is not part of the 'if' so you can't put an 'else' after it.