title: C program to find a prime number
body: <p>I wrote a C program which tells whether a given number is prime or not. But it has a problem in it. It is working fine for numbers other than multiples of 5. But it is showing the multiples of 5 as prime like 15, 25, 35, 45... . I am not able to find the error. I've tried comparing it with other programs on the internet but I am not able to find the error.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int primeornot(int a) {
      int i;
  
      for (i = 2; i &lt;= a / 2; i++) {
          if (a % i == 0) {
              return 0;
              break;
          } else {
              return 1;
          }
      }
  }
  
  main() {
      int number_given_by_user;
  
      printf("Enter a positive integer to find whether it is prime or not : ");
      scanf("%d", &amp;number_given_by_user);
  
      if (primeornot(number_given_by_user)) {
          printf("The given number is a prime number");
      } else {
          printf("The given number is not a prime number");
      }
  }
  </code></pre>