Java应用程序,用户从键盘只能输入整数,程序输出这些整数的乘积

---恢复内容开始---

import java.util.*;

public class homework{

 public static void main(String args[]){

   Scanner reader=new Scanner(Systerm.in);

   Int result=1;

    while(reader.hasNextInt()){

      Int x=reader.nextInt();

      result=result*x;

}

System.out.printf("%d个数的乘积为%d",x,result);

}

}

---恢复内容结束---

import java.util.*;

public class homework{

 public static void main(String args[]){

   Scanner reader=new Scanner(Systerm.in);

   double result=1;

    while(reader.hasNextDouble()){

      double x=reader.nextDouble();

      result=result*x;

}

System.out.printf("%d个数的乘积为%d",x,result);

}

}

原文地址:https://www.cnblogs.com/wangchunmeix/p/2948927.html