集册 Java实例教程 编写一个完整的程序,计算并打印三个整数的乘积。

编写一个完整的程序,计算并打印三个整数的乘积。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

603
编写一个完整的程序,计算并打印三个整数的乘积。

import java.util.Scanner; // program uses Scanner


public class Main 

{/* from n o w j a v a . c o m - 时代Java*/

   public static void main(String[] args)

   {

      // create Scanner to obtain input from command window

      Scanner input = new Scanner(System.in);


      int x; // first number input by user

      int y; // second number input by user

      int z; // third number input by user

      int result; // product of numbers


      System.out.print("Enter first integer: "); // prompt for input

      x = input.nextInt(); // read first integer


      System.out.print("Enter second integer: "); // prompt for input

      y = input.nextInt(); // read second integer

      

      System.out.print("Enter third integer: "); // prompt for input

      z = input.nextInt(
展开阅读全文