In this post, I will explain about a Java program to Multiply any two numbers with an example and program output.
This is a very basic program in Java programming language. If you are Java beginners or want to start learning Java programming language, then this program will help you to understand the basic Java programming.
Before executing this program I assume you have configured Java in your computer. Copy the below program and create a file “MultiplyProgram.java” and execute it to Multiply any two numbers.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import java.io.*; class MultiplyProgram { public static void main(String args[])throws Exception { int x,y,z; BufferedReader br= new BufferedReader( new InputStreamReader(System.in)); System.out.println("Enter any two numbers to Multiply:"); x=Integer.parseInt(br.readLine()); y=Integer.parseInt(br.readLine()); x = x*y; System.out.println("\nMultiplication of two numbers:"+ z); } } |
Enter any two numbers to Multiply:
50
10
Sum of two numbers: 500
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: Java program, java program to multiplication, java program to multiply two numbers, Java programming, Java programs, Java programs with examples, Java programs with output, multiply two numbers in java