Why is this variable giving me always the value of 0?
When I formatted your code for readability and then compiled it I got these warnings:

/tmp/arduino_modified_sketch_71221/sketch_may02a.ino: In function 'void loop()':
/tmp/arduino_modified_sketch_71221/sketch_may02a.ino:34:20: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   if (distance = 15);
                    ^
/tmp/arduino_modified_sketch_71221/sketch_may02a.ino:34:21: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
   if (distance = 15);
                     ^
/tmp/arduino_modified_sketch_71221/sketch_may02a.ino:41:38: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
   if ((monroy &gt;= 0) &amp;&amp; (monroy &lt;= 5));
                                      ^
/tmp/arduino_modified_sketch_71221/sketch_may02a.ino:47:40: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
   if ((monroy &gt;= 5.1) &amp;&amp; (monroy &lt;= 9));
                                        ^
/tmp/arduino_modified_sketch_71221/sketch_may02a.ino:53:21: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
   if (monroy &gt;= 9.1);


These are important - you should pay attention to them. For example, here:

  if (distance = 15);  // &lt;-- NO SEMICOLON NEEDED HERE!
  {
    digitalWrite (3, HIGH);
    delay (5000);
    digitalWrite (3, LOW);
  }


Putting a semicolon there means that stuff under the if is always executed - the semicolon terminates the scope of the if.



To see the warnings open the Preferences dialog in the IDE GUI and change "Compiler warnings" to "All".



Also:

  if (distance = 15);


This assigns 15 to distance, so distance will always be 15. You mean:

  if (distance == 15)