已知XYZ+YZZ=532,其中,X、Y、Z 为数字,编程求出X、Y 和Z 的值.
public class Test {
public static void main(String[] args) {
int X, Y, Z, sum;
for (X = 0; X < 10; X++) {
for (Y = 0; Y < 10; Y++) {
for (Z = 0; Z < 10; Z++) {
sum = X * Y * Z + Y * Z * Z;
if (sum == 532) {
System.out.println(X + "," + Y + "," + Z);
}
}
}
}
}
}