题解 | #统计输入正数个数#

统计输入正数个数

http://www.nowcoder.com/practice/3266386e460a4e219d6b7d0bed2065b9

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......
        while(true)
        {
            int input=scanner.nextInt();//输入整数需要调用scanner的方法nextInt();
            if(input>0)
                count++;
            else
                break;
        }
        System.out.println(count);
        
    }
}
全部评论

相关推荐

zzzilik:没事的,才刚刚开始,后面会捞的,这个三天没人发起面试自动结束,但是面试官还是能看到简历,四月份主战场会慢慢捞
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务