Computer Science, asked by MasterQuestioner, 1 year ago

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 duragpalsingh
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 Anonymous
6

hola mate

here is ur answer

hope this helps

. ❤❤❤❤❤

Attachments:
Similar questions