fork download
  1. #include <stdio.h>
  2.  
  3. void sort_array(int arr[], int n) {
  4. for (int i = 0; i < n; i++) {
  5. for (int j = i + 1; j < n; j++) {
  6. if (arr[i] < arr[j]) {
  7. int temp = arr[i];
  8. arr[i] = arr[j];
  9. arr[j] = temp;
  10. }
  11. }
  12. }
  13. }
  14.  
  15. int main() {
  16. int rows, cols;
  17.  
  18. printf("ввод стро: ");
  19. scanf("%d", &rows);
  20.  
  21. printf("ввод колон: ");
  22. scanf("%d", &cols);
  23.  
  24. int A[rows][cols];
  25.  
  26. printf("ввод эл:\n");
  27. for (int i = 0; i < rows; i++) {
  28. for (int j = 0; j < cols; j++) {
  29. scanf("%d", &A[i][j]);
  30. }
  31. }
  32.  
  33. sort_array(A[0], cols);
  34.  
  35. printf("ответ:\n");
  36. for (int i = 0; i < cols; i++) {
  37. printf("%d ", A[0][i]);
  38. }
  39.  
  40. return 0;
  41. }
  42.  
Success #stdin #stdout 0.01s 5304KB
stdin
3
3
45 74 29 12 45 67 15 46 74
stdout
ввод стро: ввод колон: ввод эл:
ответ:
74 45 29