Java 程式,用於計算兩個數字的乘積
* 算符在 Java 中用於乘以兩個數字。使用 Scanner 類從使用者讀取所需的數字,並使用 * 算符乘以這兩個整數。
示例
import java.util.Scanner;
public class MultiplicationOfTwoNumbers {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the value of the first number ::");
int a = sc.nextInt();
System.out.println("Enter the value of the first number ::");
int b = sc.nextInt();
int result = a*b;
System.out.println("Product of the given two numbers is ::"+result);
}
}輸出
Enter the value of the first number :: 55 Enter the value of the first number :: 66 Product of the given two numbers is ::3630
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP