This a simple Java Program to get started with java programming. This Program calculates the sum , difference , product and division of 2 numbers.
PROGRAM :
OUTPUT :
PROGRAM :
package codingcorner.in;
import java.util.Scanner;
public class ArithematicOperations {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Enter a number");
int number1 = scan.nextInt();
System.out.println("Enter another number");
int number2 = scan.nextInt();
scan.close();
int sum = number1 + number2;
int difference = number1 - number2;
int product = number1 * number2;
int division = number1 / number2;
System.out.println("Sum : " + sum);
System.out.println("Difference : " + difference);
System.out.println("Product : " + product);
System.out.println("Division : " + division);
}
}
OUTPUT :
No comments:
Post a Comment