Java Program to multiply two numbers

Description

Get two integer numbers, multiply both the integers and dispaly the product.
Input 1:
5 6
Output1:
30
Input2:
65 10
Output2:
650

Solution

import java.util.*;
class Multiplication
{
      public static void main(String args[])
      {
 
           int Input1,Input2,mul;
           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();
           mul=Input1*Input2;
           System.out.println("The Output Is:\n"+mul);
      }

}

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)
Ramesh P Natarajan

Author - Ramesh P Natarajan

Learner, Professor, Technology Trainer, Software Developer and Content Marketer, very much passionate in the field of Software Application Development, Machine Learning and Search Engine Optimization.

Write to: admin@decodeschool.com





Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution