#include<stdio.h> int main() { int n=6,i,j,temp; int arr[n] = {77,42,35,12,101,5}; for(i=0;i<n-1;i++){ for(j=0;j<n-1;j++){ if(arr[j] > arr[j+1]){ temp = arr[j]; arr[j] = arr[j+1]; arr[j+1] = temp; } } } for(i=0;i<n;i++){ printf("%d ",arr[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