Ответ:
#include <stdio.h>
#include <windows.h>
#include <math.h>
#include <time.h>
int main()
{
int A[10]={1,2,3,4,5,6,7,8,9,-3}, B[10], N = 10, l, imin,a;
printf("A[10]={1,2,3,4,5,6,7,8,9,-3}\n");
for (int i = 0; i < N - 1; i++)
imin = i;
for (int j = i + 1; j < N; j++)
if (A[j] < A[imin]) imin = j;
a = A[i];
A[i] = A[imin];
A[imin] = a;
}
for (int i = 0; i < N; i++)
printf("%d ", A[i]);
printf("\n");
system("Pause");
return 0;
Объяснение:
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
#include <stdio.h>
#include <windows.h>
#include <math.h>
#include <time.h>
int main()
{
int A[10]={1,2,3,4,5,6,7,8,9,-3}, B[10], N = 10, l, imin,a;
printf("A[10]={1,2,3,4,5,6,7,8,9,-3}\n");
for (int i = 0; i < N - 1; i++)
{
imin = i;
for (int j = i + 1; j < N; j++)
if (A[j] < A[imin]) imin = j;
a = A[i];
A[i] = A[imin];
A[imin] = a;
}
for (int i = 0; i < N; i++)
{
printf("%d ", A[i]);
}
printf("\n");
system("Pause");
return 0;
}
Объяснение: