In this program, arithmetic operators are used.

for more java programs
https://java4school.com/program-to-use-variable-datatype

Write a program to explain the use of operators in java
class operators 
{ 
public static void main() 
{ 
   int a=10; 
   int b=2; 
   int sum=a+b; 
   int subtract=a-b; 
   int product=a*b; 
   int divide=a/b; 
   int modulus=a%b; 
   System.out.println("The sum is "+sum); 
   System.out.println("The minus of a & b is "+subtract); 
   System.out.println("The product is "+product); 
   System.out.println("The quotient is "+divide); 
   System.out.println("The modulus is "+modulus); 
} 
}

OUTPUT: 
The sum is 12 
The minus of a & b is 8
The product is 20 
The quotient is 5 
The modulus is 0

for learning core java watch the videos here
https://www.youtube.com/user/trushnatej

LEAVE A REPLY

Please enter your comment!
Please enter your name here