当前位置:网站首页>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 2
sample output :
2 1 8 10
The 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 .
边栏推荐
- Upgrading Xcode 12 caused Carthage to build cartfile containing only rxswift to fail
- 2022-2028 global special starch industry research and trend analysis report
- C # use ffmpeg for audio transcoding
- DR6018-CP01-wifi6-Qualcomm-IPQ6010-IPQ6018-FAMILY-2T2R-2.5G-ETH-port-CP01-802-11AX-MU-MIMO-OFDMA
- Fatal error in golang: concurrent map writes
- The 14th five year plan and investment risk analysis report of China's hydrogen fluoride industry 2022 ~ 2028
- El Table Radio select and hide the select all box
- Report on investment analysis and prospect trend prediction of China's MOCVD industry Ⓤ 2022 ~ 2028
- Analysis report on the development status and investment planning of China's modular power supply industry Ⓠ 2022 ~ 2028
- Hands on deep learning (39) -- gating cycle unit Gru
猜你喜欢
Hands on deep learning (45) -- bundle search
直方图均衡化
Hands on deep learning (35) -- text preprocessing (NLP)
C # use gdi+ to add text with center rotation (arbitrary angle)
Hands on deep learning (44) -- seq2seq principle and Implementation
PHP is used to add, modify and delete movie information, which is divided into foreground management and background management. Foreground users can browse information and post messages, and backgroun
PHP personal album management system source code, realizes album classification and album grouping, as well as album image management. The database adopts Mysql to realize the login and registration f
el-table单选并隐藏全选框
How can people not love the amazing design of XXL job
Sort out the power node, Mr. Wang he's SSM integration steps
随机推荐
Hands on deep learning (41) -- Deep recurrent neural network (deep RNN)
Pueue data migration from '0.4.0' to '0.5.0' versions
Pcl:: fromrosmsg alarm failed to find match for field 'intensity'
Modules golang
2022-2028 global optical transparency industry research and trend analysis report
2022-2028 global gasket metal plate heat exchanger industry research and trend analysis report
Golang Modules
Global and Chinese markets for laser assisted liposuction (LAL) devices 2022-2028: Research Report on technology, participants, trends, market size and share
Hands on deep learning (34) -- sequence model
Research Report on the development trend and Prospect of global and Chinese zinc antimonide market Ⓚ 2022 ~ 2027
Hands on deep learning (42) -- bi-directional recurrent neural network (BI RNN)
Write a jison parser from scratch (1/10):jison, not JSON
查看CSDN个人资源下载明细
2022-2028 global industrial gasket plate heat exchanger industry research and trend analysis report
Log cannot be recorded after log4net is deployed to the server
H5 audio tag custom style modification and adding playback control events
Write a jison parser (7/10) from scratch: the iterative development process of the parser generator 'parser generator'
Golang Modules
Hands on deep learning (44) -- seq2seq principle and Implementation
Daughter love: frequency spectrum analysis of a piece of music