Computer Science, asked by numan26, 4 days ago

Write a java program to subtract two numbers z=x-y where x=20, y=10

Answers

Answered by 16112008
0

Answer:

import java.util.Scanner;

 

public class Exercise6 {

 

public static void main(String[] args) {

 Scanner in = new Scanner(System.in);

   

 System.out.print("Input first number: ");

 int num1 = in.nextInt();

   

 System.out.print("Input second number: ");

 int num2 = in.nextInt();

   

 

 System.out.println(num1 + " + " + num2 + " = " +  

 (num1 + num2));

   

 System.out.println(num1 + " - " + num2 + " = " +  

 (num1 - num2));

   

 System.out.println(num1 + " x " + num2 + " = " +  

 (num1 * num2));

   

 System.out.println(num1 + " / " + num2 + " = " +  

 (num1 / num2));

 

 System.out.println(num1 + " mod " + num2 + " = " +  

 (num1 % num2));

Explanation:

Similar questions