Write a java program that will input two numbers and display
Write a java program that will input two numbers and display their sum and product.
Just started java today in class and have never taken it so I am trying to get a head start on the homework before he teaches it.
As simple as this can be please.
Solution
import java.util.Scanner;
class AddNumbers
{
public static void main(String args[])
{
Scanner input = new Scanner(System.in);
int num1;
int num2;
int sum;
int product;
System.out.print(\"Enter second Number: \");
num1 = input.nextInt();
System.out.print(\"Enter first Number: \");
num2 = input.nextInt();
sum = num1 + num2;
product = num1 * num2;
System.out.println(\"The Sum of Entered Number is \" + sum);
System.out.println(\"The Product of Entered Number is \" + product);
}
}
