integer::d(14),c=0,s=0 read*,k read*,(d(i),i=1,k) do i=1,k do j=1,k-i c=c+1 l=d(j+1) if(l<d(j))then s=s+1 d(j+1)=d(j) d(j)=l endif print'("compare ="i3" swap ="i3" data:"14i3)',c,s,(d(m),m=1,k) enddo enddo end
Note that non-ascii characters in the above source code will be escaped (such as \x9f).