title: while program to display even and odd numbers
body: <p>Ok so my program is supposed to display all even numbers between 50 to 100 on one line separated by 1 comma in between integers and do the same for odd numbers on a separate line. How do I get all my outputs on one line?</p>
  
  <p><strong><em>the loop keeps printing</em></strong></p>
  
  <p>all even numbers between 50 and 100: 50</p>
  
  <p>all odd numbers between 50 and 100: 51</p>
  
  <p>all even numbers between 50 and 100: 52</p>
  
  <p>all odd numbers between 50 and 100: 53</p>
  
  <p>all even numbers between 50 and 100: 54</p>
  
  <p>all odd numbers between 50 and 100: 55</p>
  
  <p><strong><em>it should be</em></strong> </p>
  
  <p>all even numbers between 50 and 100: 50, 52, 54, 56, etc....</p>
  
  <p>all odd numbers between 50 and 100: 51, 53, 55, 57, etc.....</p>
  
  <p>here's my code</p>
  
  <pre><code> int count = 50;
  
    while (count &lt;= 100) {
  
    if (count % 2 == 0){
       System.out.println("Even numbers between 50 and 100: " + count + " ");
       count ++;
       }
    else if (count % 2 == 1){
       System.out.println("\n Odd numbers between 50 and 100: " + count + " ");
       count ++;
       }
    }
    }
    }
  </code></pre>
  
  <p>the entire program has to be under one while loop. </p>