Write a program to input two integers using Scanner and find the product of their sum and difference.
Class 9 - Computer Applications - Ch 5 - Input in JAVA
Answers
Answered by
21
Hey there!
Program to input two integers using Scanner and find the product of their sum and difference.
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);
}
}
Hope It Helps You!
Answered by
6
hola mate
here is ur answer
hope this helps
. ❤❤❤❤❤
Attachments:
Similar questions
English,
6 months ago
Math,
6 months ago
Math,
6 months ago
Math,
1 year ago
Science,
1 year ago
Economy,
1 year ago
Computer Science,
1 year ago
Accountancy,
1 year ago