当前位置:网站首页>C language: bubble sorting
C language: bubble sorting
2022-07-24 04:29:00 【Nianchi ichthyology programming】
#include <stdio.h>
int main()
{
int a[10] , i , j;
printf(" Please enter 10 Number :");
for(i = 0 ; i < 10 ; i++){
scanf("%d",&a[i]);
}
printf("\n=========== Before ordering ============\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=========== After ordering ============\n");
for(i = 0 ; i < 10 ; i++){
printf("%5d",a[i]);
}
return 0;
}
边栏推荐
- 微波技术基础实验二 功分器与定向耦合器设计
- The C host is always set separately for IIC. If enough, the next few bits can be set
- Qt5.14_ Realize the free drag and drop combination function of vs2019 panel under mingw/msvc
- C语言经典习题之猴子吃桃问题
- Can NFT pledge in addition to trading?
- 智能合约:发布一种ERC20代币
- Write a search box with search tips
- Privacy protection federal learning framework supporting most irregular users
- adobe PR2022 没有开放式字幕怎么办?
- Shell syntax (2)
猜你喜欢

Application scenarios and schemes of common mechanical equipment safety virtual simulation system
【望解答】数据无法正确同步了

What if Adobe pr2022 doesn't have open subtitles?

What if the references in the word sent by others are {} in such a garbled format

Shell语法(一)

Hardware knowledge 3 -- IIC protocol

IP second experiment mGRE OSPF

PMIX ERROR: ERROR in file gds_ds12_lock_pthread.c

C语言经典习题之猴子吃桃问题

Privacy protection federal learning framework supporting most irregular users
随机推荐
Ambire wallet opens twitter spaces series
Where is the difficulty in attracting investment in the park? Inventory of difficulties and difficulties in attracting investment in industrial parks
Design and implementation of data analysis platform for intelligent commerce
Analyze the real-time development method of Bank of London
Shell语法(一)
Billiard simulator based on the integration of GL pipeline and ray tracing technology
ARP Spoofing protection of network security
由硬件确定(服务的服绍,可参看官方2 和
工程师能力模型与技能要求
阿里淘系面试题:Redis 如何实现库存扣减操作和防止被超卖?
IP second experiment mGRE OSPF
00cm non, make sure to go online with the business party once in advance, and make everything better
00cm的非,与业务方确预上线一次,把所为有更好的泛
Application scenarios and schemes of common mechanical equipment safety virtual simulation system
Hardware knowledge 3 -- IIC protocol
"Paper reproduction" bidaf code implementation process (3) model establishment
dispatch_ Once's Secret
[09] program loading: "640K memory" is really not enough?
64 attention mechanism 10 chapters
Write a search box with search tips