代码改变世界

作业2

2013-03-13 12:20  郭莹莹1114010807  阅读(86)  评论(0编辑  收藏  举报

import java.util.*;
public class Example2{
    public static void main (String args[ ]){
       Scanner reader=new Scanner(System.in);
       int product=1;
       int n=0;
       while(reader.hasNextInt()){
           int x=reader.nextInt();
           n=n+1;
           product=product*x;
       }
       System.out.printf("%d个数的积为%f\n",n,product);
    }
}