当前位置:网站首页>Enter four integers in descending order
Enter four integers in descending order
2022-04-21 08:29:00 【Sainbo】
#include<stdio.h>
#include<windows.h>
void test01()
{
}
void test02()
{
int a, b, c, d, m, i, j, t, n;
int num[4] = {a, b, c, d};
printf(" Please enter four integers :\n");
for(m = 0; m < 4; m++)
{
scanf("%d", &num[m]);
}
// Bubble method is used to calculate sorting
// here for Number of cycles , Also available i=1 i<=4 i++
for (i = 0; i < 4; i++)
{
// The loop comparison here must use the total number of variables -1 subtracting i
for (j = 0; j < 3 - i; j++)
{
if (num[j] > num[j + 1])
{
t = num[j +1];
num[j + 1] = num[j];
num[j] = t;
}
}
}
// Output
printf(" The entered four digit integers are sorted from small to large :\n");
for (n = 0; n < 4; n++)
{
printf("%d\t", num[n]);
}
}
void main()
{
test02();
system("pause");
}

版权声明
本文为[Sainbo]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210805241654.html
边栏推荐
- Find the maximum common divisor and the minimum common multiple
- js第十二篇
- [Tools]Pwn中用于远程交互的库函数总结
- ASUS good screen 120Hz high refresh rate, opening a new pattern of OLED Market
- Liunx下Navicat连接mysql报错ACCESS DENIED FOR USER ‘ROOT‘@‘XXX.XXX.XXX.XXX‘ (USING PASSWORD: YES
- 深入浅出 Ext4 块和 Inode 分配器的优化(下)
- 多线程小抄集(新编四)
- Be sure to watch the nine steps of MES selection, which is worth collecting and watching repeatedly (Part 2)
- 输入四个整数按照从小到大的顺序排列
- 一定要看,MES选型九步,你漏掉了哪一步?(上)
猜你喜欢
随机推荐
一定要看,MES选型九步,你漏掉了哪一步?(上)
Unity clones only 48 cubes
php快速将二维数组的中某个值提为数组键值,array_column的妙用.
JVM——》吞吐量
Linux 配置redis 开机自动启动
[nodejs] nodejs basic supplement (III) - this context object
docker怎么访问宿主中redis服务6379端口
Insert a new node before the linked list node
knn预测最小案例总结
什么是父子关系和菱形继承
webapi(六)- BOM
链表的静态插入和动态遍历
实验一:数据库的基本操作
千万别贪便宜,免费的MES系统可不一定好
31 drop down box codes of provinces, municipalities and autonomous regions directly under the central government
php的urldecode无法还原出原来的url
6. 堪比JMeter的.Net压测工具 - Crank 实战篇 - 收集诊断跟踪信息与如何分析瓶颈
怎么将chrome console控制台中变量原样的复制出来并保存下载到本地
Static insertion and dynamic traversal of linked list
knn之交叉验证,网格搜索
![[nodejs] nodejs basic learning (II) - module mechanism](/img/9b/f7246550e9b021231eafaed25908d3.png)







