解题思路:
注意事项:
参考代码:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] arr = new int[n]; for (int i = 0; i < arr.length; i++) { arr[i] = sc.nextInt(); } int count = 0; for (int i = 0; i < arr.length; i++) { if (arr[i] != 0) { System.out.print(arr[i]+" "); count++; } } System.out.println("\n"+count); } }
0.0分
4 人评分
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:587 |
1113题解浏览:786 |
循环入门练习5 (C语言代码)浏览:839 |
C二级辅导-公约公倍 (C语言代码)浏览:1310 |
C语言程序设计教程(第三版)课后习题6.4 (C语言代码)浏览:1189 |
1073题解浏览:623 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:489 |
【偶数求和】 (C语言代码)浏览:436 |
小九九 (C语言代码)浏览:500 |
简单的a+b (C语言代码)浏览:601 |