Generation

generate functionSat, 12 Nov 2022

sort an array

int arr[6] = {6, 3, 9, 5, 1, 2}; int temp; for (int i = 0; i < 6; i++) { for (int j = i; j < 6; j++) { if (arr[i] < arr[j]) { temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } } }

Questions about programming?Chat with your personal AI assistant