#include <stdio.h> int main() { int x[5]={8, 10, 6, 2, 4}; int temp, i, j; for(i=0; i<=4; i++) for(j=0; j<4; j++) if(x[j] > x[j+1]) { temp=x[j]; x[j]=x[j+1]; x[j+1]= temp; } for(i=0; i<=4; i++) printf("%d ", x[i]); return 0; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter