Please state the problem clearly. The original post has values of
127 and
128. In your latest post, you say the range is "
not important" (okay), but could be "
1 to 100," or "
1..80." You say each line has
10 numbers, but in your example, each line has
20 numbers. Okay, fine, we can leave some parameters open for now, but the larger problem is that I still don't know what the basic requirement is. Do you mean
any pair which occurs more/most often? For example, 48 and 75 appear in all 4 lines; that looks like a winner. Or does it have to be 03 and 29 like you said?
If you want to count all pairwise occurrences, I suggest that you set up a list, or an array, to count all possible pairs: 1&2, 1&3, 1&4, ..., 2&3, 2&4, 2&5, ..., 79&80. For 1..N, that is N*(N-1)/2 possible pairs. I suggest that you count with 2 nested loops. Outer loop steps through each line, item by item, not including the last item. Inner loop steps through all items following the item of the outer loop.
Code:
outer loop: for(i=1;i<10;i++)
inner loop: for(j=i+1;j<=10;j++)
Finally, you mentioned that you have code to count the total number of times a number is found. That code will be of little or no use for finding and counting pairwise occurrences. To count pairs is a completely different problem. Frequency of single occurrence is not necessarily related to frequency of occurrence in pairs.