Advertisement
Guest User

Untitled

a guest
May 20th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. public class cos {
  2.  
  3.  
  4.  
  5.  
  6. public static void main(String[] args) {
  7.  
  8. int G[][] = new int[10][10];
  9. int GG[][] = new int[10][10];
  10. int F[][] = new int[10][10];
  11.  
  12.  
  13.  
  14. System.out.println("\nMatrix 1\n----------------------------");
  15. int n = 0;
  16. for(int i = 0; i < 10; i++)
  17. {
  18. for(int j = 0; j < G[i].length; j++)
  19. {
  20.  
  21.  
  22. G[i][j] = j + n;
  23. n = 1;
  24. System.out.print(G[i][j] + " ");
  25. }
  26. System.out.println();
  27. }
  28. System.out.println("\nMatrix2\n----------------------------");
  29.  
  30. for(int i = 0; i < GG.length; i++)
  31. {
  32. for(int j = 0; j < GG[i].length; j++)
  33. {
  34. GG[i][j] = i + 1;
  35. System.out.print(GG[i][j] + " ");
  36. }
  37. System.out.println();
  38. }
  39. System.out.println("\nTo co wyszlo\n----------------------------");
  40.  
  41. for(int row = 0; row < F.length; row++)
  42. {
  43. for(int column = 0; column < F[row].length; column++)
  44. {
  45. // Addition
  46. F[row][column] = GG[row][column] +
  47. G[row][column];
  48.  
  49. System.out.print(F[row][column] + " ");
  50. }
  51. System.out.println();
  52. }
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement