Write a Java program that takes two numbers and display the product of two numbers


Introduction

In this demo I have used NetBeans IDE 8.2 for debugging purpose. But you can use any java programming language compiler as per your availability..


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. import java.util.Scanner;
  2.  
  3. public class Javaexcercise{
  4.  
  5. public static void main(String[] args) {
  6. Scanner in = new Scanner(System.in);
  7.  
  8. System.out.print("Input 1st number: ");
  9. int number1 = in.nextInt();
  10.  
  11. System.out.print("Input 2nd number: ");
  12. int number2 = in.nextInt();
  13.  
  14. System.out.println("Product of two numbers: "+ number1 + " x " + number2 + " = " + number1 * number2);
  15. }
  16.  
  17. }

Result

java techstudy.org

     





Related Topics




Popular Posts