import java.util.*; public class Main { public static void main(String[] args) { int count = 0; Scanner scanner = new Scanner(System.in); //write your code here...... //注意数据类型应保持一致,先用nextInt方法筛出整型数据,再判断是否为正数 while(scanner.nextInt()>0){ count++; } System.out.println(count); } }