Traditional Culture Encyclopedia - Traditional stories - C language: bubble sorting method sorts 10 elements in the array from small to large, and finds out the minimum value?
C language: bubble sorting method sorts 10 elements in the array from small to large, and finds out the minimum value?
# include & ltstdio.h & gt
int main()
{
int a[ 1 1],min=0,t;
for(int I = 0; I< 10; i++)
scanf("%d ",& ampa[I]);
min = a[0];
for(int I = 0; I< 10; i++)
if(a[I]& lt; Min)// Find the minimum value?
min = a[I];
for(int I = 0; I< 10; I++)// bubble sort?
for(int j = 0; j & lt9-I; j++)
if(a[j]& gt; a[j+ 1])
{
t = a[j];
a[j]= a[j+ 1];
a[j+ 1]= t;
}
for(int I = 0; I< 10; i++)
printf("%d?" ,a[I]);
printf("\n%d ",min); ?
Returns 0;
}
- Previous article:Successful case analysis of network new media marketing
- Next article:What are the famous scenic spots in Tianjin?
- Related articles
- The Difference and Weaving of Hanfu and Kimono Patterns
- What are the TV programs to enjoy ancient poems?
- Which one is better, the new craft white tea or the traditional craft white tea?
- What is the digital culture industry?
- How to grow soybean sprouts at home
- Shandong Classic Dishes
- Title: I appreciate this life-Yuan Longping's composition is between 400 and 450 words.
- What is the name of the guqin with the first five strings and the second string?
- What kind of mooncake is the most delicious?
- Your unique taste. English translation.