Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Integer [] Array = new Integer[10];
- Random rand = new Random();
- for (int i = 0 ; i < Array.length ; i++) {
- int rand_int1 = rand.nextInt(51);
- Array[i] = rand_int1;
- }
- System.out.print("Array: ");
- for (int i = 0 ; i < Array.length ; i++) {
- System.out.print(Array[i] + " ");
- }
- System.out.print("\nValue to find: ");
- Scanner keyboard = new Scanner(System.in);
- int numFind = keyboard.nextInt();
- System.out.println();
- for (int i = 0 ; i < Array.length ; i++) {
- if (Array[i] == numFind) {
- System.out.println(numFind + " is in the Array.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement