#include <stdio.h>
#include <stdlib.h>

int main(void)
{
  int max, num, divisor, is_prime;

  printf("Enter a number: ");
  scanf("%d", &max);
   
  printf("prime numbers between 2 and %d: \n", max);
  
  num=2;
  
  while (num<=max)   {
    
  is_prime = 1;
  divisor=2;
    
  while(divisor <= num/2){         
    
	if((num%divisor)==0)   {       //if(!(num%divisor))   {
         is_prime = 0;  
		 break;
	}
    divisor++;
  }
  
  if(is_prime)            // if(is_prime==1) 
      printf("%d \t", num);
  
  num++;
}

  printf("\n");
  
 system("pause");
  
  return 0;
}
