วันอาทิตย์ที่ 22 กันยายน พ.ศ. 2556

Maxtric Calculation



void setup() {
  size (50, 150);
  background (255, 255, 0);
  int z = 10;
  int[][] M = {
    {
      1, 2, 3
    }
    , {
      4, 5, 6
    }
    , {
      0, 7, 8
    }
  };
  int[][] m = {
    {
      9, 8, 0
    }
    , {
      2, 1, 3
    }
    , {
      7, 5, 7
    }
  };
  int[][] Ans = new int[3][3];

  int i, j;
  for (i=0;i<M.length;i++) {
    for (j=0;j<M[i].length;j++) {
      Ans[i][j] = M[i][j]+m[i][j];
      fill (0);
      text((Ans[i][j]), 20, 10+z);
      z=z+15;
    }
  }
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น