初學
唔識個loop 應該點寫
有冇高人指點一下
forloop // do sth on x
{
forloop // do sth on y
{
forloop // do sth on z
{
if (x - 2y + 3z == 0)
then print result
}
}
}
for x in range(1,6):
for y in range(6,11):
for z in range(3,8):
if ( x - 2 * y + 3 * z == 0 ):
print("x={}, y={}, z={}".format(x,y,z))
var x = [1, 2, 3, 4, 5];
var y = [6, 7, 8, 9, 10];
x.forEach(xNum => {
y.forEach(yNum => {
result = xNum + 2 * yNum;
remainer = (xNum + 2 * yNum) % 3;
if (!remainer) {
console.log("x: " + xNum + " y: " + yNum + " z: " + result / 3);
}
})
})