import iostuff.*;
public class FindNumber
{
	public static int find (int [] a, int p)
	{
		//look through list a to see if p is there
		for (int k=0; k<a.length; k++)
		{
			if (a[k] == p)
			{
				return k;
			}
		}
		//if p is NOT in the list, the program will reach here
		return -1;
	}	
	
	public static void main (String [] args)
	{
		int [] numbers = {12, 5, 39, 24, 59, 29, 18, 24};
		
		System.out.print("What number are you looking for? ");
		int x = Keyboard.readInt();
		System.out.println (x);
		
		int position = find (numbers, x);
		if (position == -1)
		{
			System.out.println ("Your number is not in the list.");
		}
		else
		{
			System.out.println ("The first occurrence of " + x
						+ " is at position " + (position+1) + ".");
		}
	}
}