用java
打印数组然后每三个元素换行
程序代码:
public class Main { public static void main(String[] args) { int[] arr = { 1, 2, 3, 4, 5 ,6, 7, 8, 9 }; for (int i = 0; i < arr.length; i++) { System.out.print(arr[i] + " "); if ((i + 1) % 3 == 0) { System.out.println(); } } } }