import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { String[] str = sc.nextLine().split(" "); StringBuilder res = new StringBuilder(); for (int i = str.length - 1; i > 0; i--) { res.append(str[i]+" "); } res.append(str[0]); System.out.println(res.toString()); } } }
#include<stdio.h> int main(){ int arr[10]; for(int i = 0;i < 10;i++) scanf("%d",&arr[i]); for(int i = 9;i >= 0;i--) printf("%d ",arr[i]); return 0; }
#include <stdio.h> int main() { int arr[11]={0}; int i=0; for(i=1;i<=10;i++) { scanf("%d ",&arr[i]); } for(i=10;i>=1;i--) { printf("%d ",arr[i]); } return 0; }
#include <stdio.h> int main() { int array[10]; int i; for(i=0;i<10;i++) { scanf("%d",&array[i]); } for(i=9;i>=0;i--) { printf("%d ",array[i]); } return 0; }
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int[] nums = new int[10]; for (int i = 0; i < nums.length; i++) { nums[i] = in.nextInt(); } for (int i = nums.length-1; i >= 0; i--) { System.out.print(nums[i] + " "); } } }
#include <stdio.h> int main() { int arr[10] = {0}; int i=0; printf("请输入十个整数:\n"); for (i = 0; i < 10; i++) { scanf("%d", &arr[i]); } printf("逆序输出:\n"); for (i = 9; i >= 0; i--) { printf("%d ", arr[i]); } return 0; }