write a program to input two integers using Scanner and find the product of their sum and difference
Answers
Answered by
2
Answer:
20
Explanation:
public class AddTwoNumbers {
public static void main(String[] args) {
int num1 = 5, num2 = 15, sum;
sum = num1 + num2;
System.out.println("Sum of these numbers: "+sum);
}
}
Output:
Sum of these numbers: 20
in jaava program
Answered by
4
Answer:
import java.util.*;
public class Question3
{
static void main()
{
Scanner sc=new Scanner(System.in);
int a,b,s,d,p;
System.out.println("Enter two integers:");
a=sc.nextInt();
b=sc.nextInt();
s=a+b;
d=a-b;
p=s*d;
System.out.println("Sum="+s);
System.out.println("Difference="+d);
System.out.println("Product of Sum and Difference="+p);
}
}
Similar questions