write a program in Qbasic to take as input two numbers. find and display a) The sum of two numbers b) The product of two numbers c) the difference between the product and sum of two numbers
Answers
Answered by
2
import java.util.*;
public class Number
{
⠀⠀public static void main (String args [])
⠀⠀{
⠀⠀Scanner in = new Scanner (System.in);
⠀⠀int a,b,s,p,d;
⠀⠀System.out.println("Enter the two numbers :");
⠀⠀a = in.nextInt();
⠀⠀b = in.nextInt();
⠀⠀s = (a+b);
⠀⠀p = (a*b);
⠀⠀d = ((a*b) - (a+b));
⠀⠀System.out.println("Sum of the two numbers =" +s);
⠀⠀System.out.println("Product of the two numbers =" +p);
⠀⠀System.out.println("Difference between the product and the sum of the two numbers =" +d);
⠀⠀}
}
Similar questions