当前位置:网站首页>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;
}
边栏推荐
- Baidu search cracking down on pirated websites: why Internet content infringement continues despite repeated prohibitions
- 训练数据量不只适用于.z据接收方对数字视
- Once svchost Troubleshooting of exe process occupying a large amount of network bandwidth
- [C language] program environment and preprocessing operation
- Alibaba Taobao Department interview question: how does redis realize inventory deduction and prevent oversold?
- Send data 1010_ 1. The number of bytes passed by the sender
- MySQL service 1 master 2 slave, master master, MHA configuration detailed steps
- C语言经典习题之编写一个程序,找出1000以内所有的完数。
- 【2023芯动科技提前批笔试题】~ 题目及参考答案
- C语言经典习题之评委打分去掉最高最低求平均分
猜你喜欢

What new opportunities exist in the short video local life section?

mysql服务1主2从,主主,MHA配置详细步骤

Exploration of new mode of code free production

Leetcode 20 valid parentheses, 33 search rotation sort array, 88 merge two ordered arrays (nums1 length is m+n), 160 intersecting linked list, 54 spiral matrix, 415 character addition (cannot be direc

(008) flask is OK if you have a hand -- database migration flask migrate

PMIX ERROR: ERROR in file gds_ds12_lock_pthread.c

(5) Digital electricity formula simplification method

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

Function application of 4G transmission module

The problem of monkeys eating peaches in classic exercises of C language
随机推荐
一次 svchost.exe 进程占用大量网络带宽的排查
值为 0 流程,另一部分看括但不限于如下这题是
conda 常用命令
Codeforces Round #807 (Div. 2) A - D
ECB interface is also mdsemodet in essence
直播课堂系统04-创建service模块
CONDA common commands
智能合约:发布一种ERC20代币
How to perform chowtest with Stata
iPhone手机绑定163邮箱解决方案
微波技术基础实验二 功分器与定向耦合器设计
From bio to realizing the function of simple multi person chat room -- IO model
Game improvement of smart people: Lesson 2 of Chapter 3: number of factors
Insider of LAN SDN hard core technology 22 Kang long regrets -- Specifications and restrictions (Part 2)
The second anniversary of opengauss' open source, cracking the pain point of database ecology
MySQL service 1 master 2 slave, master master, MHA configuration detailed steps
The problem of monkeys eating peaches in classic exercises of C language
Exploration of new mode of code free production
Chery arizer 8 products are powerful, and "all excellent" is not for nothing
(5) Digital electricity formula simplification method