title: Random Math Question Generator not following while loop
body: <p>I'm a new java coder getting into it doing a project. I coded it how i believe the system would execute it and yet it doesn't seem to be following the While loops requirements. I want it to generate random number, do a random operation, then ask the user for an answer. The answer must be not decimal and the random numbers must be below 10 to make the questions easier as its for a lower target audience. I'm kind of stuck now on this piece. Apologies if this doesn't make sense as i say it is a first attempt for me.</p>
  
  <pre><code>import java.util.Random;
  import java.lang.Math;
  import java.util.Scanner;
  
  public class RandomisedQuestions{
      public static void QuestionGenerator(){
          Random r = new Random();
          Scanner s = new Scanner(System.in);
          int intA = 0;
          int intB = 0;
          char operator ='?';
          double value = 1.2;
  
      for (int i = 0; i &lt; 3; i++) {
          intA = (int)(10.0 * Math.random());//the (int) forces the number to be an int
          intB = (int)(10.0 * Math.random());
          if (intA &lt;= 0 &amp;&amp; intB &lt;= 0){
                  intA = (int)(10.0 * Math.random());//the (int) forces the number to be an int
                  intB = (int)(10.0 * Math.random());
                  System.out.println(intA + intB);
          }
  
          while ((value % 1) !=0 &amp;&amp; value &gt; 1){//Runs while value is not whole
  
              switch (r.nextInt(4)){
                  case 0: operator = '+';
                      value = intA+intB;
                      break;
                  case 1: operator = '-';
                      value = intA-intB;;
                      break;
                  case 2: operator = '*';
                      value = intA*intB;;
                      break;
                  case 3: operator = '/';
                      value = intA/intB;;
                      break;
                  default: operator = '?';
              }
              //System.out.println(operator);
          }
          System.out.println(intA +""+ operator +""+ intB);
          System.out.println("Enter the answer");
          int uGuess = s.nextInt();
  
          if (uGuess == value){
              System.out.println("Correct");
          }
          else{
              System.out.println("Incorrect");
          }
      }
  }   
  </code></pre>
  
  <p>}</p>