Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
801 B
3
Indexable
Never
package ex_arr;

import java.util.Random;
import java.util.Scanner;

public class ex_arr {
	
	static void FillArr (int [] arr) {
		 Random r = new Random();	 
		 int low = 10;
		 int high = 100;
		 for(int i=0;i<arr.length;i++)
	        {
	            arr[i] = r.nextInt(high-low) + low;	            
	            }
	}
	static void PrintArr(int [] arr) {
		for(int i=0; i < arr.length; i++ ) {
			System.out.print(arr[i] + " ");
		} 
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.print("Введите количество элементов массива: ");
		int count = (int) sc.nextDouble();	
		sc.close();
		
	      int[] arr;
	      arr = new int[count]; 
	      FillArr (arr);  
	      PrintArr (arr);
	}
}