双增量

时间:2013-05-13 10:32:55

标签: java for-loop double increment

我正试着锻炼下面的图像。我尝试过使用for循环,但似乎无法获得正确的结果。 有人可以帮助我吗...感谢加载!

这是我的代码:

double XCor = 10;
double YCor = 10;

double incrt = 0.1;

int j = 0;
while (j <= 10) {
    for (double i = 0.0; i <= XCor; incrt++) {
        System.out.println("Count is: " + i);
    }
    double x = j / YCor;
    System.out.println("Count is: " + x);
    j++;
}

enter image description here

1 个答案:

答案 0 :(得分:0)

for (double x = 0.0; x <= XCor; x += incrt) {
  for (double y = 0.0; y <= YCor; y += incrt) {
    System.out.printf("x=%f, y=%f\n", x, y);
  }
}