Ответ: c++
#include <iostream>
using namespace std;
int main()
{
const int N = 10;
int A[N] = { 14, 25, 13, 30, 76, 58, 32, 11, 41, 97 };
for (int i = 0; i < N; i++)
for (int j = N - 1; j > i; j--)
if (A[j] % 10 < A[j-1] % 10)
swap(A[j-1], A[j]);
}
cout << "The array after sorting:" << endl;
cout << A[i] << " ";
return 0;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ: c++
#include <iostream>
using namespace std;
int main()
{
const int N = 10;
int A[N] = { 14, 25, 13, 30, 76, 58, 32, 11, 41, 97 };
for (int i = 0; i < N; i++)
{
for (int j = N - 1; j > i; j--)
{
if (A[j] % 10 < A[j-1] % 10)
{
swap(A[j-1], A[j]);
}
}
}
cout << "The array after sorting:" << endl;
for (int i = 0; i < N; i++)
{
cout << A[i] << " ";
}
return 0;
}