Valeri173

Обръщане на реда на елементите на масив

May 17th, 2020
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main6 {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         int n = scan.nextInt();
  7.         int arr[] = new int[n];
  8.         for (int a = 0; a < n; a++) {
  9.             arr[a] = scan.nextInt();
  10.         }
  11.  
  12.         for (int i = arr.length - 1; i >= 0; i--) {
  13.             System.out.print(arr[i] + " ");
  14.         }
  15.     }
  16. }
Add Comment
Please, Sign In to add comment