当前位置:网站首页>ZZULIOJ:1119: sequence order
ZZULIOJ:1119: sequence order
2022-07-30 22:56:00 【catch up】
1119: 1D array sorting
Time limit: 1 Sec Memory limit: 128 MB
[Status] [Discussion Board] [Submit] [Submit by:admin]
Title description
Sort one-dimensional arrays in ascending order.The program defines the function sort() to sort the array a.The function prototype is as follows:
void sort(int a[], int n);
The output of an array element calls PrintArr().
Enter
Enter an integer n (1<=n<=10) in the first line, indicating that the array has n integers; input n integers in the second line.
Output
The output is on one line.Output the n integer numbers in ascending order, and separate the data with a space.
Sample input Copy
66 5 1 2 3 4
Sample output Copy
1 2 3 4 5 6
Reference code
#include #include #define N 10void sort(int a[],int n);void PrintArr(int a[], int n);int main(){int a[N];int n, i;scanf("%d", &n);for(i=0;ia[j]){t=a[j];a[j]=a[i];a[i]=t;}}}}void PrintArr(int a[], int n){int i;for(i=0;i
边栏推荐
- Navicat connection MySQL error: 1045 - Access denied for user 'root'@'localhost' (using password YES)
- 2022/07/30 学习笔记 (day20) 面试题积累
- 详解操作符
- for...in 和 for...of 的区别
- Go的Gin框架学习
- Apache Doris系列之:安装与部署详细步骤
- ZZULIOJ:1120: 最值交换
- 2022.7.28
- MySQL compressed package installation, fool teaching
- Go语学习笔记 - gorm使用 - 表增删改查 Web框架Gin(八)
猜你喜欢
随机推荐
只会纯硬件,让我有点慌
一文详解:SRv6 Policy模型、算路及引流
Go1.18升级功能 - 模糊测试Fuzz 从零开始Go语言
language code table
力扣题(3)—— 无重复字符的最长子串
Py's pdpbox: a detailed introduction to pdpbox, installation, and case application
可视化工具Netron介绍
使用LVS和Keepalived搭建高可用负载均衡服务器集群
成功解决ModuleNotFoundError: No module named ‘Image‘
二进制序列
Learning about XML (1)
The most complete Redis basic + advanced project combat summary notes in history
[MySQL] DQL related operations
grub 学习
for...in 和 for...of 的区别
1064 Complete Binary Search Tree
力扣题(2)—— 两数相加
连号区间数
VS2017编译Tars测试工程
Reverse linked list - in-place inversion method