anonymous / gist:9979510
Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist
View gist:9979510
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import java.util.Scanner;
 
public class tesstt {
public static void main (String args []) {
System.out.print("Array: ");
int [] arr = new int[9];
for (int i = 0; i < arr.length; i++) {
arr[i] = (int) (1 + (Math.random() * 50));
System.out.print(" " + arr[i]);
}
System.out.print("\nValue to find: ");
Scanner s = new Scanner(System.in);
int find = s.nextInt();
for (int i = 0; i < arr.length; i++) {
if (arr[i] == find) {
System.out.print(find + " is in the array.\n");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.