C Programming Code Examples C > Arrays and Matrices Code Examples C program to print all negative elements in array C program to print all negative elements in array Write a C program to input elements in array and print all negative elements. How to display all negative elements in array using loop in C program. Displaying negative, positive, prime, even, odd or any special number doesn't requires special skills. You only need to know how to display array elements and how to check that special number. Declare and input elements in array. Run a loop from 0 to N-1 (where N is array size). The loop structure should look like for(j=0; j<N; j++). For each element in array, if current element is negative i.e. if(array[j] < 0) then print it. #include <stdio.h> #define maxsize 100 // Maximum array size int main() { int arr[maxsize]; // Declare array of maxsize int j, N; /* Input size of the array */ printf("Enter size of the array : "); scanf("%d", &N); /* Input elements in the array */ printf("Enter elements in array : "); for(j=0; j<N; j++) { scanf("%d", &arr[j]); } printf("\nAll negative elements in array are : "); for(j=0; j<N; j++) { /* If current array element is negative */ if(arr[j] < 0) { printf("%d\t", arr[j]); } } return 0; }