CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*link to the challange
https://www.sololearn.com/Discuss/634515/?ref=app */
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
int a,count=0;
cin >> a;
int arr[a];
cout << "You have entered: a = "<<a<<endl;
for(int i=0;i<a;i++)
{
if(i==0){cout <<"[";}
arr[i]=10+rand()%89;
cout <<arr[i];
if(i<a-1){cout << ",";}
else{cout<<"] \n"<< endl;}
}
for(int i=0;i<a;i++)
{
for(int p=i+1;p<a;p++)
{
if(arr[i]>arr[p])
{cout<<"->"<<arr[i] << "," << arr[p]<<" is an inverse"<<endl;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run