Created
March 31, 2015 14:29
-
-
Save Sergaav/e6c914726db0fd4addb6 to your computer and use it in GitHub Desktop.
dz4_2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gmail.sergaav.dz4_2; | |
import java.util.Scanner; | |
import java.util.Random; | |
public class dz4_2 { | |
public static void main(String[] args) { | |
System.out.println("Input massive length: "); | |
Scanner sc = new Scanner(System.in); | |
int n; | |
n = sc.nextInt(); | |
int[] mas = new int[n]; | |
Random rn = new Random(); | |
for (int i = 0; i < mas.length; i++) { | |
mas[i] = rn.nextInt(10); | |
} | |
System.out.println("Randomized massive: \n"); | |
for (int i = 0; i < mas.length; i++) { | |
System.out.print(mas[i] + " "); | |
} | |
System.out.println(); | |
System.out.println("Mirror massive \n"); | |
for (int i = 0; i < mas.length; i++) { | |
System.out.print(mas[mas.length - (i + 1)] + " "); | |
} | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment