title: Prime Number program
body: <p>I want to make a program in C language which will take the user input and I would not be able to understand the logic of the loop.</p>
  
  <pre><code>for ( c = 2 ; c &lt;= n - 1 ; c++ )
  </code></pre>
  
  <p>The program code is given below:-</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;conio.h&gt;
  
  void main()
  {
     int n, c;
  
     printf("Enter a number to check if it is prime\n");
     scanf("%d", &amp;n);
  
     for ( c = 2 ; c &lt;= n - 1 ; c++ )
     {
        if ( n % c == 0 )
        {
           printf("%d is not prime.\n", n);
           break;
        }
     }
     if ( c == n )
        printf("%d is prime.\n", n);
  
     getch();
  }
  </code></pre>
  
  <p>I have used the for loop which will end up the statement of <code>n - 1</code> in for loop. If I will give the input <code>11</code> then it will end up on <code>11 - 1 = 10</code> then how it will give up the logic of  <code>if(c == n) { printf("%d", n);</code>?</p>