fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. int n, temp;
  13. int temp1,temp2;
  14.  
  15. int a[] = new int[] {3,19,14,12,23,24};
  16. int b[] = new int[] {13,18,3,7,13,4};
  17. int c[] = new int[] {9,22,25,16,29,28};
  18.  
  19. /* a[6]= {3,19,14,12,23,24};
  20.   b[6]= {13,18,3,7,13,4};
  21.   c[6]= {9,22,25,16,29,28};
  22.   */ for (int i = 0; i < 6; i++)
  23. {
  24. for (int j = i + 1; j < 6; j++)
  25. {
  26. if (a[i] > a[j])
  27. {
  28. temp = a[i];
  29. a[i] = a[j];
  30. a[j] = temp;
  31.  
  32. temp1=b[i];
  33. b[i]=b[j];
  34. b[j]=temp1;
  35.  
  36. temp2=c[i];
  37. c[i]=c[j];
  38. c[j]=temp2;
  39.  
  40. }
  41. }
  42. }
  43. System.out.print("Ascending Order:");
  44. for (int i = 0; i < 6; i++)
  45. {
  46. System.out.print(a[i]+" "+b[i]+" "+c[i]);
  47. System.out.println();
  48. }
  49. // your code goes here
  50. }
  51. }
Success #stdin #stdout 0.04s 711168KB
stdin
Standard input is empty
stdout
Ascending Order:3 13 9
12 7 16
14 3 25
19 18 22
23 13 29
24 4 28