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){
  11. int[] vetA = {1,2,3,4,5};
  12. int[] vetB = {1,2,3,4,5};
  13. int[][] mat = new int[5][5];
  14.  
  15. for(int i = 0; i < vetA.length;i++){
  16. for(int j = 0; j < vetB.length; j++){
  17. mat[i][j] = vetA[i] * vetB[j];
  18. }
  19. }
  20.  
  21. for(int i = 0; i < mat[0].length; i++){
  22. for(int j = 0; j < mat.length;j++ ){
  23. System.out.print(mat[i][j] + " ");
  24. }
  25. System.out.println();
  26. }
  27. }
  28. }
Success #stdin #stdout 0.04s 4386816KB
stdin
Standard input is empty
stdout
1 2 3 4 5 
2 4 6 8 10 
3 6 9 12 15 
4 8 12 16 20 
5 10 15 20 25