Here is my code:
这是我的代码:
#include<stdio.h>
#include<cs50.h>
int main(void)
{
int array[8] = {2, 5, 3, 1, 4, 6, 9, 7};
for (int j = 0; j < 8; j++)
{
for (int i = 0; i < 8 ; i++)
{
if (array[i] > array[i + 1])
{
int temp = array[i];
array[i] = array[i + 1];
array[i + 1] = temp;
}
}
}
for (int i = 0; i < 8; i++)
printf("%i", array[i]);
printf("\n");
}
#include<stdio.h>