adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Write a program in Java to Subtract two numbers

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



Post a Comment

0 Comments