#include
using namespace std;
int main() {
int n;
cin>>n;
long a[n];
for(int i=0;i<n;i++)
cin>>a[i];
int cnt=0;
for(int i=n-1;i>0;i–)
{ for(int j=i-1;j>=0;j–)
{if(a[j]>a[i])
cnt++;
}
}
cout<<cnt<<endl;
// your code goes here
return 0;
}
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
Also what everule1 said… Format the code
1 Like
thanks a lot can you please guide more about formatting?
Use ``` this symbol at start of code and at the end
1 Like
@shreyaa04 You might wanna read/bookmark the following articles, which will help you to format and write better next time on the Code-Chef DIscuss platform.
Good practice for asking help - #6 by ssjgz
[Tutorial] CoLoR format the Code!
1 Like