ariestamirra

Find Array

Apr 6th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.57 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class findArray{
  4.  
  5.     public static void main(String args[]){
  6.       int[][] arrayOfInts = {{ 32, 87, 3, 589 }, { 12, 1076, 2000, 8 },{ 622, 127, 77, 955 }};
  7.       Scanner in = new Scanner(System.in);
  8.       int ketemu;
  9.       ketemu = 0;
  10.       System.out.print("Input the value\t: ");int cari = in.nextInt();
  11.       for(int x=0; x<3;x++){
  12.         for(int y=0; y<4;y++){
  13.           if(cari == arrayOfInts[x][y]){
  14.             System.out.println("Found "+cari+ " at "+x+" , " +y);
  15.             ketemu=1;
  16.           }
  17.         }
  18.       }
  19.       if(ketemu==0){
  20.       System.out.println(cari+" Not Found!");
  21.       }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment