import java.util.Random;
import java.util.Scanner;
public class RandomArray {
public static void main(String[] args) {
int arr[]=new int[50];
Random r = new Random();
for(int i=0;i<arr.length;i++)
{
arr[i]=r.nextInt(100);
System.out.print(arr[i]+" ");
if(i!=0
&& i%10==0)
System.out.println();
}
Scanner sc = new
Scanner(System.in);
int index;
System.out.print("\nEnter an index:
");
index=sc.nextInt();
while(index<0 || index>=50)
{
System.out.print("Out of Bound. Try again:
");
index=sc.nextInt();
}
System.out.println("The element is
"+arr[index]);
}
}

Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
JAVA: (15 marks) Write a program that creates an integer array with 50 random values, prompts...
The ExceptionLab class provided: – Creates an array of 100
elements and fills it with random numbers from 1 to 100. – It asks
the user for an index value between 0 and 99. – Prints the element
at that position. – If a number > 99 is entered by the user, the
class will abort with an ArrayIndexOutOfBoundsException • Modify
the ExceptionLab: – Add a try-catch clause which intercepts the
ArrayIndexOutOfBounds and prints the message: Index value cannot be...
For Java - Write a program that creates an array of 10 integers. Ask the user to enter the subscript (index) of an element, then displays the element located at that subscript. If the subscript entered is out of bounds (less than 0 or greater than length - 1), display the message "Out of Bounds".
Write a C program to assign natural numbers 1 to 100 into a one-dimensional integer array. Display all the values in the array on the screen. For each number in the array, determine if the number contains digit 7 or is divisible by 7. Display all those numbers on the screen. Original array: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27...
I need help wrting a java program that creates an array with 20 randomly chosen integers. The program should prompt the user for an index of the array and display the corresponding element value. If the specified index is out of bounds,display the message "Out of Bounds".
(ArrayIndexOutOfBoundsException) Write a program that meets the following requirements: ■ Creates an array with 100 randomly chosen integers. ■ Prompts the user to enter the index of the array, then displays the corresponding element value. If the specified index is out of bounds, display the message Out of Bounds. Following modifications: * Use either a Scanner object or JOptionPane.showInputDialog() for input. * Use either System.out.println() or JOptionPane.showMessageDialog() for output. * In addition to ArrayIndexOutOfBoundsException, also catch InputMismatchException or NumberFormatException, and...
I need to develop the 7 functions below into the main program
that's given on top
Write a C program to create array, with random numbers and perform operations show below. Il Project 3 (53-20). 1 Projects CS5,00 This file contains the function Programcution Dagine and one include <timo // Defining some constants definer_SIZE 20 define LOVE LIMIT 1 eine UPR UNIT define TALSE eine Tut 1 wold randomizery (int[], int, Int, int) wold pinay in. St, Int); En find...
Python 3 Create a function that takes an array and an integer v, and returns the number of v occurrences in the array. Add a variable Nsteps to count how many times the loops have executed and display that information in a message The main program must take an array / list 2D, call the function, and display the result. >>>l3 = [52, 14, 14, 8, 85, 69, 1, 77, 94, 96, 51, 65, 35, 32, 87, 92, 74, 47,...
I need it in JAVA Write a program that randomly populates an array of size 100, sorts it, and then finds the median. The random numbers must be from 0-99 and all integer values. Also since there is an even set of numbers the median is found by taking the mean of the two middle numbers (In other words the 50th and 51st). You have to code your own sorting method. You may not use a built in java sorter....
Write a program that will create an array of ten integers, allow the user to enter those integers, and eventually search through the array based on index position: 1. Declare the array. You cannot assign elements to an array until it has first been created. 2. Next, run a for loop so that the user can enter an integer to save in each index position of the array. Since you this array holds ten elements , the index position starts...
Use C++ (2D Array) Write a program which: 1. Assigns data given below into the 2D array of integers which is 10x10. 2. Prints out the contents of the 2D array after assigning the data to make sure correct data was assigned. 3. Figures out and prints out the square root of the sum of ALL the elements in the 2D array. 4. Figures out and prints out the average of ALL THE ELEMENTS in the 2D array. 5. Figures...