Triacontakai

TriacontakaiSimilarity

Feb 22nd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.87 KB | None | 0 0
  1. /**
  2. * Triacontakai
  3. * Period 6
  4. * This program compares 2 arrays and recognizes how many numbers
  5. * there are in the same place in both arrays
  6. */
  7. public class TriacontakaiSimilarity{
  8.     public static void main(String[] args){
  9.         System.out.println("Welcome!\n");
  10.         int[] a1 = {5, 9, 4, 2, 0, 7, 3, 1, 8, 2};
  11.         int[] a2 = {9, 2, 5, 2, 8, 7, 4, 2, 8, 2};
  12.         int sim = 0;
  13.         System.out.print("First Array:  ");
  14.         for(int i = 0; i <= 9; i++){
  15.             System.out.print(a1[i] +" ");
  16.         }
  17.         System.out.print("\nSecond Array: ");
  18.         for(int i = 0; i <= 9; i++){
  19.             System.out.print(a2[i] +" ");
  20.         }
  21.         for(int i = 0; i <= 9; i++){
  22.             if(a1[i] == a2[i]){
  23.                 sim++;
  24.             }
  25.         }
  26.         System.out.println("\n\nThere are "+ sim +" numbers in the same spot.");
  27.     }
  28. }
Add Comment
Please, Sign In to add comment