Java 代码
import java.util.Scanner;
public class Main
{
public static void main (String[] args)
{
Scanner cin = new Scanner(System.in);
int[] X = new int[10];
for (int i = 0; i < X.length; i++)
{
X[i] = cin.nextInt();
if (X[i] <= 0)
X[i] = 1;
System.out.println("X[" + i + "] = " + X[i]);
}
}
}