当前位置:网站首页>Exercise 7-3 store the numbers in the array in reverse order (20 points)
Exercise 7-3 store the numbers in the array in reverse order (20 points)
2022-07-04 09:47:00 【skeet follower】
This question requires the preparation of procedures , Will be given n An integer is stored in the array , Put this... In the array n The number is stored in reverse order , Then output the elements in the array in order .
Input format :
Input gives a positive integer in the first line n(1≤n≤10). Second line input n It's an integer , Separate with spaces .
Output format :
Output this on one line n The processing result of an integer , Adjacent numbers are separated by a space , There must be no extra space at the end of the line .
sample input :
4
10 8 1 2sample output :
2 1 8 10The code is as follows :
#include<stdio.h>
int main()
{
int n,i;
scanf("%d",&n);
int a[n];
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("%d",a[n-1]);
for(i=n-2;i>=0;i--){
printf(" %d",a[i]);
}
return 0;
}summary : Topics need attention , It requires that there should be no extra spaces at the end of the output line , So we should output the last element first , utilize for Loop to output other elements in turn .
边栏推荐
- Summary of reasons for web side automation test failure
- `Example of mask ` tool use
- C # use gdi+ to add text to the picture and make the text adaptive to the rectangular area
- System.currentTimeMillis() 和 System.nanoTime() 哪个更快?别用错了!
- Hands on deep learning (42) -- bi-directional recurrent neural network (BI RNN)
- Hands on deep learning (33) -- style transfer
- 法向量点云旋转
- IIS configure FTP website
- 2022-2028 global industrial gasket plate heat exchanger industry research and trend analysis report
- Flutter 小技巧之 ListView 和 PageView 的各種花式嵌套
猜你喜欢

pcl::fromROSMsg报警告Failed to find match for field ‘intensity‘.

Log cannot be recorded after log4net is deployed to the server

Hands on deep learning (43) -- machine translation and its data construction
What are the advantages of automation?

Regular expression (I)

Sort out the power node, Mr. Wang he's SSM integration steps

2022-2028 research and trend analysis report on the global edible essence industry

C # use ffmpeg for audio transcoding

C语言指针面试题——第二弹

Daughter love: frequency spectrum analysis of a piece of music
随机推荐
法向量点云旋转
回复评论的sql
Machine learning -- neural network (IV): BP neural network
Investment analysis and future production and marketing demand forecast report of China's paper industry Ⓥ 2022 ~ 2028
华为联机对战如何提升玩家匹配成功几率
MySQL transaction mvcc principle
Write a mobile date selector component by yourself
El Table Radio select and hide the select all box
How can Huawei online match improve the success rate of player matching
Hands on deep learning (39) -- gating cycle unit Gru
Global and Chinese market of wheel hubs 2022-2028: Research Report on technology, participants, trends, market size and share
Svg image quoted from CodeChina
lolcat
Summary of the most comprehensive CTF web question ideas (updating)
C language pointer interview question - the second bullet
技术管理进阶——如何设计并跟进不同层级同学的绩效
浅谈Multus CNI
In the case of easyUI DataGrid paging, click the small triangle icon in the header to reorder all the data in the database
Get the source code in the mask with the help of shims
Application of safety monitoring in zhizhilu Denggan reservoir area