You are on page 1of 1

LAB 1 EXERCISE 3 Shafai Tahir

02-134192-059

Q: Type-in the following example, which receives the input of two integer numbers and compute the

sum, difference and product. Compile and run this program.

INPUT:
package javaapplication5;

import java.util.Scanner;

public class JavaApplication5 {

public static void main(String args[]){

Scanner input = new Scanner(System.in);

int number1;

int number2;

System.out.print("Enter First Number: ");

number1 = input.nextInt();

System.out.print("Enter Second Number: ");

number2 = input.nextInt();

System.out.println("Sum is: " + (number1 + number2));

System.out.println("Difference is: " + (number1 - number2));

System.out.println("Product is: " + (number1 * number2));}}

OUTPUT:

You might also like