#8 | Arithmetic maths operators | Java tutorial for beginners

#8 | Arithmetic maths operators | Java tutorial for beginners

16 View

Publish Date:
4 September, 2023
Category:
Computers and Technology
Video License
Standard License
Imported From:
Youtube

In this video we start learning about at arithmetic operators, +, -, * and /.

Here is the source code contained in this video:

public class Main {
public static void main(String[] args) {
// declare variables
int firstNum, secondNum, thirdNum, result;
// assign some values to the variables
firstNum = 7;
secondNum = 14;
thirdNum = 21;
// perform some maths

// add-up
result = (firstNum + secondNum);
System.out.println("The result of the addition is " + result);

// subtract
result = 0;
result = (secondNum - firstNum);
System.out.println("The result of the subtraction is " + result);

// multiply
result = 0;
result = (firstNum * secondNum * thirdNum);
System.out.println("The result of the multiplication is " + result);

// divide
result = 0;
result = (thirdNum / firstNum);
System.out.println("The result of the divide is " + result);
}
}

Here are the study notes from this video:

//Arithmetic operators are used to perform mathematical operations on the values contained in variables.
//The + operator is used to add together two values.
//The - operator is used to subtract one value from another.
//The * operator is used to multiply two or more values.
//The / operator is used to divide one value by another.


Did you miss our previous article...
https://learningvideos.club/computer-technology/triggers-in-sql-triggers-in-database-sql-triggers-tutorial-for-beginners-edureka-rewind