#output will be 1 2 3 4 5
#for input n=8
#array elements 1 2 3 3 2 4 4 5
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    set<int> s;
    for(int itr: a){
        s.insert(itr);
    }
    for(auto it: s){
        cout<<it<<" ";
    }
    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: