Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main(){
- int s,temp,i,j,a[10001],k,c=0;
- scanf("%d",&s);
- for(i=1; i<=s; i++)
- scanf("%d",&a[i]);
- for(i=1; i<=s; i++)
- {
- for(j=1; j<s; j++)
- {
- if(a[j]>a[j+1])
- {
- temp=a[j];
- a[j]=a[j+1];
- a[j+1]=temp;
- c++;
- }
- }
- }
- printf("%d\n",c);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement