>

Friday, February 22, 2013

Compare Two Integer Arrays

This program will compare two integer arrays and return a result number of matching numbers in those arrays :
public void arrayMatcher(int a[], int b[])
{
   
    int count=0;
    for(int i=0;i<a.length;i++)
    {
        for(int j=0;j<b.length;j++)
        {
            if((a[i])==(b[j]))
            {
                count++;
   
            }
        }
       
    }
    System.out.println(count+" numbers matches in two arrays");
   
   
} 
CONTENT WARNING:This is my own program.. It is for Educational purposes only. Please do not republish or reproduce with another name in online.

No comments:

Post a Comment

Please post your comments. Your comments make us to write more programs for you.