Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
in shorted array print without duplicate o/p array
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
#include <bits/stdc++.h> using namespace std; int main() { int size; cout<<"Enter the size :"<<endl; cin>>size; int arr[size]; for(int i=0;i<size;i++) {cin>>arr[i];} for(int i=0;i<size;i++) {cout<<arr[i]<<" ";}cout<<endl<<endl; for(int i=0;i<size;i++) { if(arr[i]==arr[i+1]) { for(int j=i+1;j<size;j++) { if(arr[i]==arr[j]) {arr[i]=arr[j];} } //cout<<arr[i]<<" "; } else {cout<<arr[i]<<" ";} } //if(arr[i]==arr[j]){ cout<<arr[j];break;} // else cout<<arr[j];break; //cout<<arr[i]<<flag2; return 0; }
g++
12 1 1 1 2 2 3 3 3 3 3 3 4
Show compiler warnings
[
+
] Compiler args
[
-
]
Show input
Compilation time: 1.35 sec, absolute running time: 0.15 sec, cpu time: 0.01 sec, memory peak: 5 Mb, absolute service time: 1,59 sec
edit mode
|
history
|
discussion
Enter the size : 1 1 1 2 2 3 3 3 3 3 3 4 1 2 3 4