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

Calculate Compound Interest in JavaScript

How to make simple bill maker by using python tkinter

Admin Login Page Using HTML and CSS