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

int divisible(int *p) {
    
    int j;
    
       if (*p%3) {
             return 0;
       } 
       else  {
    	     return 1; 
	   }
   
       
  
}  

int main() {
  int number, *ptr,  i;

  printf("Enter the number of elements: ");
  scanf("%d", &number);

  int A[number];
  ptr = A; 
  
  printf("The array:\n");
  
  for(i=number ; i>0 ; i--, ptr++) {   //The elements of the array 
       *ptr=i;   
       printf("%d\t", *ptr);
       }
   
   printf("\nThe elements indivisible by 3:\n");
   
   ptr = A;                         // ptr points to the first element                  
      
   for(i=0 ; i<number ; i++, ptr++) {  //writes the elements indivisible by 3
      if (!divisible(ptr)) 
      printf("%d\n", *ptr);
      
    }

       
    system("pause");
    return 0;
}
