Java Program to multiply two numbers

Get two integer numbers, multiply both the integers and display the product.

Sample Input 1:

5 6

Sample Output 1:

30

Sample Input 2:

65 10

Sample Output 2:

650

Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

public class Hello { public static void main(String args[]) { //Write your code here } }

Program or Solution

				
			
					
import java.util.*;
class Multiplication
{
      public static void main(String args[])
      {
 
           int Input1,Input2,product;
           Scanner sc=new Scanner(System.in);

           System.out.println("Enter The Input 1:");
           Input1=sc.nextInt();
           System.out.println("Enter The Input 2:");
           Input2=sc.nextInt();
           product=Input1*Input2;
           System.out.println("The Output Is:\n"+product);
      }

}
			
				
			

Program Explanation

Get two integers Input1 and Input2 (using scanner class) multiply Input1 and Input1, then store the product in mul (mul=Input1*Input2) print the value of mul (using system.out.println)

Comments