Computer Science, asked by mataranikijai1234, 10 hours ago

write a program in java to input two numbers and print their sum and difference​

Answers

Answered by safashamon567
0

import java.util.*;

public class sumDiff

{

   public void display()

   {

       Scanner Sc = new Scanner(System.in);

       System.out.println("Enter two numbers");

       int num1 = Sc.nextInt();

       int num2 = Sc.nextInt();

       int sum = num1 + num2;

       int diff = num1 - num2;

       System.out.println("The sum is "+sum);

       System.out.println("The difference is "+diff);

   }

}

Similar questions