title: Prime number Program - what am I doing wrong?
body: <p>I, I'm a beginner in c++ and programming in general. I'd really appreciate it if you could help me with this.</p>
  
  <p>I've been trying to write a program that tells you if a given number is prime or not (It's supposed to print "prime" if it is)</p>
  
  <p>Here is the code I came up with:</p>
  
  <pre><code>int main() {
  
      cout&lt;&lt;"enter a number";
      int x;
  
      cin&gt;&gt;x;
  
      int y = 2;
  
      int remainder = 1;
  
      while(y&lt;x,remainder!=0) {    
          remainder = (x%y);
          y++;
       }
  
       if (remainder!=0) {
          cout&lt;&lt;"prime";
       }
  }
  </code></pre>
  
  <p>The problem is the program won't print "prime" for any number. I suppose there are more efficient ways to write such a program, but could you tell me what's the problem with the way I did it? </p>
  
  <p>Thank you. I Hope it's not too simple, though I'm afraid it is...</p>