当前位置:网站首页>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 second anniversary of open source, opengauss Developer Day 2022 full highlights review!
- Parallel technology of Oracle
- Oracle的并行技术
- [translation] announce krius -- accelerate your monitoring and adoption of kubernetes
- 在一线城市上班的程序员,家庭一般是怎样的?
- Alibaba Taobao Department interview question: how does redis realize inventory deduction and prevent oversold?
- LeetCode 46 全排列
- C语言经典习题之评委打分去掉最高最低求平均分
- Energy principle and variational method note 11: shape function (a dimension reduction idea)
- 可以脱离设据生效这些都是控化部署能力,而后引如
猜你喜欢

"Paper reproduction" bidaf code implementation process (3) model establishment

Write a search box with search tips

Hardware knowledge 3 -- IIC protocol
![[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?

Jinglianwen technology provides 3D point cloud image annotation service

Clickpaas, a low code service provider, has completed a strategic merger with BiP technology to jointly build an industrial digital base

An accident caused by MySQL misoperation, and "high availability" can't withstand it
![[untitled]](/img/c1/23797dd628641d524b55a125e95c52.png)
[untitled]

PMIX ERROR: ERROR in file gds_ ds12_ lock_ pthread.c

一次 svchost.exe 进程占用大量网络带宽的排查
随机推荐
"Paper reproduction" bidaf code implementation process (3) model establishment
[untitled]
J9 number theory: what is Web3.0? What are the characteristics of Web3.0?
(008) flask is OK if you have a hand -- database migration flask migrate
Chery arizer 8 products are powerful, and "all excellent" is not for nothing
The judges of C language classic exercises score the highest and lowest to get an average score
Write a search box with search tips
C language classic exercises
Redis sentinel mode, master node check script
Particle Designer:粒子效果制作器,生成plist文件并在工程中正常使用
C language classic exercises to write a program to find all the perfects within 1000.
1.7.1 right and wrong problem (infix expression)
What is the real HTAP? (2) Challenge article
What new opportunities exist in the short video local life section?
What if the references in the word sent by others are {} in such a garbled format
Up sampling method (deconvolution, interpolation, anti pooling)
buu web
智能合约:发布一种ERC20代币
Design and implementation of data analysis platform for intelligent commerce
由硬件确定(服务的服绍,可参看官方2 和