"switch,case" syntax inside of "if" syntax need help

void loop() {


  const byte ROWS = 4; //four rows
  const byte COLS = 4; //four columns
  //define the cymbols on the buttons of the keypads
  char hexaKeys[ROWS][COLS] =
  {
    {'#', '#', '#', '*'  },
    {'3', '#', '#', '7'  },
    {'2', '#', '5', '6'  },
    {'1', '#', '4', '#'  }
  };

  byte rowPins[ROWS] = {A12, A13, A14, A15}; //connect to the row pinouts of the keypad
  byte colPins[COLS] = {A11, A10, A9, A8}; //connect to the column pinouts of the keypad

  //initialize an instance of class NewKeypad
  Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins, colPins, ROWS, COLS);

  int correct = 0;
  char customKey = customKeypad.getKey();  //get the key value


  digitalWrite(triggerPin, LOW);// put your main code here, to run repeatedly:
  delayMicroseconds(2);
  digitalWrite(triggerPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(triggerPin, LOW);
  unsigned long duration = pulseIn(echoPin, HIGH);
  int distance = duration / 29 / 2; // Distance measurement using Ultrasonic sensor 


  if (distance >= 0.1 && distance <= 2 ) {
    lcd.setCursor(4, 0);
    lcd.println("1  f l o o r");
  }
  else if (distance >= 7 && distance <= 9 ) {
    lcd.setCursor(4, 0);
    lcd.println("2  f l o o r");
  }
  else if (distance >= 14 && distance <= 16) {
    lcd.setCursor(4, 0);
    lcd.println("3  f l o o r");
  }

  // Determining the number of floors according to distance


  unsigned int i4, i5, i6, i7;
  if (customKey == '5') {
    i5 = 0;
  }
  if (customKey == '4') {
    i4 = 0;
  }
  if (customKey == '6') {
    i6 = 0;
  }
  if (customKey == '7') {
    i7 = 0;
  }



  if (distance >= 0.1 && distance <= 7) {
    switch (customKey) {

      case '2' :
        myStepper.step(-stepsPerRev * 1.1);
        break ;

      case '3' :

        myStepper.step(-stepsPerRev * 1.1);

        if (strcmp (i5, 0) == 0) {
          delay (5000);
          myStepper.step(-stepsPerRev * 1.1);
        }
        else {
          myStepper.step(-stepsPerRev * 1.1);
        }
        break ;
    }
  }

  if (distance >= 7.5 && distance <= 8.5) {
    switch (customKey) {
      case'1' :
        myStepper.step(stepsPerRev * 1.1);
        break;

      case '3' :
        myStepper.step(-stepsPerRev * 1.1);
        break;
    }
  }

  if (distance >= 9 && distance <= 20) {
    switch (customKey) {

      case '2' :
        myStepper.step(stepsPerRev * 1.1);
        break;

      case '1' :
        myStepper.step(stepsPerRev * 1.1);
        if (strcmp (i6, 0) == 0) {
          delay (5000);
          myStepper.step(stepsPerRev * 1.1);
        }
        else {
          myStepper.step(stepsPerRev * 1.1);
        }
        break ;
    }

  }


  if (customKey)
  {
    lcd.setCursor(4, 1);
    lcd.print("keyValue: ");
    lcd.println(customKey);
  }

  delay(100);
}

I’m trying to operate the stepper motor when i press the button. and at the first if-switch syntax,

My intention is when i press the customKey number ‘3’ only, stepper motor will operate one time and once

again and in case of pressing customKey number ‘5’ after pressing number ‘3’ , stepper motor will operate

one time and after than perform delay(5000) and lastly drive once again

but some how the motor doesn’t perform commands separately under the ‘if,else’ condition in the ‘case’

syntax.

int distance = duration / 29 / 2; // Distance measurement using Ultrasonic sensor 


  if (distance >= 0.1

Why the fraction?

To make the elevator, Measure the position of the elevator box from the floor with an ultrasonic sensor.

and I gave it a tolerance because it wasn't exactly where I wanted it to be when it actually moved.

int FLOOR1  = 1; //cm
int FLOOR2  = 8; 
int FLOOR3  = 16;

const int stepsPerRev=2048 ;
Stepper myStepper(stepsPerRev,11,9,10,8);

int duration;
int triggerPin = 12;
int echoPin = 13;


LiquidCrystal_I2C lcd(0x27, 16, 2);



void setup() {
 // put your setup code here, to run once:
myStepper.setSpeed(10);

pinMode(triggerPin, OUTPUT);
pinMode(echoPin, INPUT);
lcd.init();

lcd.backlight();


}

You do realise that the "int" datatype doesn't store fractions?

oh i didn't see that
well I just switched to Float and tried again but nothing changed

well I just switched to Float and tried again but nothing changed

You changed your code. You didn’t post the revised code.

The code does something that only you can see. You expect it to do something that you have not shared.

You are just here to whine, right? Otherwise, you’d have provided a lot more information.