C program to find non-repeating elements in an array

Non-repeating elements of an array

In this section, we will learn the Java Program to Find the Elements that do Not have Duplicates or the elements that do not repeat itself.

Given an array, print all element whose frequency is one.


Input: a[]= { 1,2,5,2,6,7,5 }

There is three number which has one frequency.

so there is three number which is not repeated.

Java program for conting non repeating elements in an array


Step 1. Input the size of array from the user.

Step 2. Input the elements of array from the user.

Step 3. Count the frequency of each element.

Step 4. If it is equal to 1, Print the elements of new array

C Program

#include <stdio.h>  
int main()  
    int n, i , j, count=0, unique = 0;;
    printf("enter size : ");
    int arr[n];
    printf("enter elements : ");
    for(i=0; i<n; i++)
    for(i=0; i<n; i++)
        count = 0;
        for(j=0; j<n; j++)
            printf("%d ",arr[i]);
    return 0;

Enter size of an array
Enter elements of array
12 2 12 3 9 2
3 9