Last Updated: 14 August, 2022
On this tutorial page we are going to learn how to write a Java program to subtract two numbers (integer or float) and produce the result.
There are two programs given below. In the first program, both numbers are written in the program itself. In the second program, user is asked to enter the two numbers and the program calculates the subtraction of the input numbers and produce the subtraction of both numbers as an output.
subtraction of two numbers = number1 - number2
Let's see the Java program implementation.
Output
First Number: 150.55
Second Number: 50.25
Subtract of two numbers: 100.3
Output
Enter first number: 100.5
Enter second number: 50.5
Subtract of two numbers: 50.0
That's all guys, hope this Java Program is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com