Operator in java, addition, multiplication Operator in java.

Operator in java. Arithmatic operation using operator.

Hi welcome to my blog.

In this article we are going to discuss operator operation in java.

Before you understand this code you have to knowledge about operator and assignment in java.

Code:

import java.util.*; 

class Test

{

public static void main(String[] args) {

int x;

Scanner s1=new Scanner(System.in);

System.out.println("Enter your first no.");

int num1=s1.nextInt();

System.out.println("Enter your second no.");

int num2=s1.nextInt();

x=num1+num2;

System.out.println("The addition of two number"+x);

x=num1-num2;

System.out.println("The substraction of two number"+x);

x=num1*num2;

System.out.println("The product of two number"+x);

x=num1/num2;

System.out.println("The division of two number"+x);

x=num1%num2;

System.out.println("The remainder of two number"+x);

}

}

OUTPUT:

Enter your first no.

5

Enter your second no.

4

The addition of two number = 9

The substraction of two number = 1

The product of two number = 20

The division of two number = 1

The remainder of two number = 1


                                            Thank You?



0 K comment

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel