Create a program to demonstrate the use of Arithmetic Operators in java

 Create a program to demonstrate the use of Arithmetic Operators in java

public class ArithemeticOperators
{
    public static void main(String args[]){
    int a = 20 , b = 10//Variables are declared and initialized
    int result;
    result = a+b;
    System.out.println(result); //Result affter addition will be displayed as 30
    result = a-b;
    System.out.println(result); //After subtraction the result will be displayed as 10
    result = a*b;
    System.out.println(result); //After multiplication the result will be displayed as 200
    result = a/b;
    System.out.println(result); //After division the result will be displayed as 2
    result = a%b;
    System.out.println(result); //After modulus the result will be displayed as 0
    }
}
Output
30
10
200
2
0

Comments

Popular posts from this blog

How to make simple bill maker by using python tkinter

Make a GST Calculator using HTML and JavaScript

Write a program to find the sum of 1/2+4/3+5/6+8/7+9/10 using loop in java