Ejemplo: resta de dos números en java
import java.util.Scanner;
public class SubtractionOfTwoNumbers
{
public static void main(String[] args)
{
int num1, num2, subtraction;
System.out.println("Please enter two numbers to substract: ");
Scanner sc = new Scanner(System.in);
num1 = sc.nextInt();
num2 = sc.nextInt();
subtraction = num1 - num2;
System.out.println("subtraction of two numbers = " + subtraction);
sc.close();
}
}
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)