In this program, arithmetic operators are used.

for more java programs

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); 

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


Please enter your comment!
Please enter your name here