JAVA作业题第二题

来源:互联网 发布:linux vim环境配置 编辑:程序博客网 时间:2024/05/16 18:55
import java.util.*;
public class job2{
 public static void main(String args[]){
  Scanner reader=new Scanner(System.in);
  int result=1;
  while(reader.hasNextInteger()){
   int x=reader.nextInteger();
   result=result*x;}
  System.out.printf("这些整数的积为%d\n",result);
}
}
原创粉丝点击