This website includes Education Information like a programming language, job interview question, general knowledge.mathematics

Education log

PageNavi Results No.

Ads

Saturday, April 10, 2021

arithmetic operator in java programming

 arithmetic operator in java programming


These operators include mathematical operators that can be used to perform simple or advanced arithmetic operations on older data types called operators These operators consist of various unary and binary operators that can be used on one or two operators respectively. Let's take a look at the various Java operators to offer under the statistics providers.


What is an arithmetic operator?

Arithmetic operators are the symbols that represent arithmetic math operations. Examples include + (addition operator), - (subtraction operator), * (multiplication operator), and / (division operator). Operator, Programming terms.



+ Addition

- Subtraction

* Multiplication

/ Division





write a java program to perform arithmetic operator :


class Main {

  public static void main(String[] args) {

    

    // declare variables

    int a = 12, b = 5;


    // addition operator

    System.out.println("a + b = " + (a + b));


    // subtraction operator

    System.out.println("a - b = " + (a - b));


    // multiplication operator

    System.out.println("a * b = " + (a * b));


    // division operator

    System.out.println("a / b = " + (a / b));


    // modulo operator

    System.out.println("a % b = " + (a % b));

  }

}




output:


arithmetic operator in java programming


No comments:

Post a Comment