Write a program in Java to Subtract two numbers
import java.util.Scanner; class SubtractDemo { public static void main(String []args) { Scanner cin = new Scanner(System.in); System.out.print("Enter two integer numbers :- "); int x = cin.nextInt(); int y = cin.nextInt(); System.out.println("Sum of two integer value = "+(x + y)); System.out.print("\nEnter two float numbers :- "); float a = cin.nextFloat(); float b = cin.nextFloat(); System.out.println("Sum of two float values = "+(a + b)); } }
Output :-

Related Programs
0 Comments