TOPIC

WHY COMPILATION ERROR PLEASE EXPLAIN

Just cse 18 zihad asked 1 year ago

include

int main()

{ int i,j,t,l,a[100],count; scanf("%d",&t); for(int i=0;i<t;i++) { count=0; scanf("%d",&l); for(i=0;i<l;i++) { scanf("%d",&a[i]); } for(i=1;i<=l;i++){

        for(j=0;j<l-i;j++)
        {
            if(a[j]>a[j+1])
            {
                count++;
                t=a[j];
                a[j]=a[j+1];
                a[j+1]=t;

            }
        }

    }
    printf("Optimal train swapping takes %d swaps.\n",count);
}

return 0;

}

Remember not post solutions. Your post may be reviewed by our moderators.

  • mohammed Yeasin replied 10 months ago

    you made a mistake in defining header file....it can not be just include ....you have to write #include in the first line