write the program in java to find out the multiple of two numbers
Answers
Explanation:
When you start learning java programming, you get these type of problems in your assignment. Here we will see two Java programs, first program takes two integer numbers (entered by user) and displays the product of these numbers. The second program takes any two numbers (can be integer or floating point) and displays the result.
Answer:
import java.util.Scanner;
public class Demo {
public static void main(String[] args) {
/* This reads the input provided by user
* using keyboard
*/
Scanner scan = new Scanner(System.in);
System.out.print("Enter first number: ");
// This method reads the number provided using keyboard
double num1 = scan.nextDouble();
System.out.print("Enter second number: ");
double num2 = scan.nextDouble();
// Closing Scanner after the use
scan.close();
// Calculating product of two numbers
double product = num1*num2;
// Displaying the multiplication result
System.out.println("Output: "+product);
}
}
Explanation: