Question F: example 6-1 inverse output array element

Source: Internet
Author: User

Question F: example 6-1 inverse output array element time limit: 1 Sec memory limit: MB
Flowers: 155 Resolution: 137
Flowers Wreath [TK Bank] Title Description

Entering 10 integers from the keyboard, stored in an integer array of length 10, requires the output of the 10 numbers in reverse order.

If input is: 0,1,2,3,4,5,6,7,8,9 output is 9,8,7,6,5,4,3,2,1,0

Enter 10 integers, separated by a space, output 10 integers in reverse order, one row for each number. Sample input
0 1 2 3 4 5 6 7 8 9
Sample output
9876543210

Reference code:

#include <stdio.h>
int main () {
int a[10];
for (int i=0;i<10;i++) {
scanf ("%d", &a[i]);
}
for (int i=0;i<5;i++) {
int temp=a[i];
A[i]=a[9-i];
A[9-i]=temp;
}
for (int i=0;i<10;i++) {
printf ("%d\n", A[i]);
}
return 0;
}

Question F: example 6-1 inverse output array element

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.