Answers for "pairs in array"

1

pair in array

import java.io.*;
import java.util.*;


public class Main
{
  public static void main (String[]args)
  {

     int a[] = { 1,2,3,4,5,6};
     int n = a.length;
     
     
     int r = n-1;
     for(int i=0;i<n;i++){
         int l = i;
         while(l<r){
             System.out.print("("+a[l]+","+a[r] + ")   ");
             r--;
         }
         r=n-1;
     }
     
  }
}
Posted by: Guest on March-07-2021

Code answers related to "pairs in array"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language