当前位置:网站首页>C语言:冒泡排序法
C语言:冒泡排序法
2022-07-24 04:25:00 【念迟鱼学编程】
#include <stdio.h>
int main()
{
int a[10] , i , j;
printf("请输入10个数:");
for(i = 0 ; i < 10 ; i++){
scanf("%d",&a[i]);
}
printf("\n===========排序前============\n");
for(i = 0 ; i < 10 ; i++){
printf("%5d",a[i]);
}
for(i = 0 ; i < 9 ; i++){
for(j = 0 ; j < 9 - 1 - i ; j++){
if(a[j] > a[j+1]){
int t = a[j];
a[j] = a[j+1];
a[j+1] = t;
}
}
}
printf("\n===========排序后============\n");
for(i = 0 ; i < 10 ; i++){
printf("%5d",a[i]);
}
return 0;
}
边栏推荐
- Preliminary use of swagger2
- 致-.-- -..- -
- 基于GL Pipeline与光线追踪技术的融合实现的台球模拟器
- Codeforces Round #807 (Div. 2) A - D
- What if Adobe pr2022 doesn't have open subtitles?
- Parallel technology of Oracle
- [translation] announce krius -- accelerate your monitoring and adoption of kubernetes
- How safe is Volvo XC90? Come and have a look
- 组合数(阶乘的质因子的个数,组合数的计算)
- Codeforces Round #809 (Div. 2) A - D1
猜你喜欢

From bio to realizing the function of simple multi person chat room -- IO model

Collection of test case design methods

An accident caused by MySQL misoperation, and "high availability" can't withstand it

Function application of 4G transmission module

Educational Codeforces Round 132 A - D

Chery arizer 8 products are powerful, and "all excellent" is not for nothing

阿里淘系面试题:Redis 如何实现库存扣减操作和防止被超卖?

一次 svchost.exe 进程占用大量网络带宽的排查
![[dish of learning notes, dog learning C] Dachang written test, is that it?](/img/4c/71c7268e40f0e2a15f52083022d565.png)
[dish of learning notes, dog learning C] Dachang written test, is that it?

How does the trend chart of spot silver change?
随机推荐
Shell syntax (2)
The second anniversary of opengauss' open source, cracking the pain point of database ecology
What if Adobe pr2022 doesn't have open subtitles?
MySQL service 1 master 2 slave, master master, MHA configuration detailed steps
To -.---
Collection of test case design methods
The pit trodden by real people tells you to avoid the 10 mistakes often made in automated testing
How to change the direction of this gracefully
Preliminary use of swagger2
Application scenarios and schemes of common mechanical equipment safety virtual simulation system
PMIX ERROR: ERROR in file gds_ds12_lock_pthread.c
Jinglianwen technology provides 3D point cloud image annotation service
嵌入式系统移植【6】——uboot源码结构
《论文复现》BiDAF代码实现过程(3)模型建立
Ambire gas tank launches exclusive NFT launch
Embedded system transplantation [6] - uboot source code structure
Particle Designer: particle effect maker, which generates plist files and can be used normally in projects
Redis sentinel mode, master node check script
Introduction to the application fields and functions of bank virtual human technology
Post it notes --46{hbuildx connect to night God simulator}