Skip to content

Instantly share code, notes, and snippets.

@rmg007
Created October 3, 2022 21:02
Show Gist options
  • Save rmg007/24bac1ae91e29e8a1ffa0fa7e1a406cf to your computer and use it in GitHub Desktop.
Save rmg007/24bac1ae91e29e8a1ffa0fa7e1a406cf to your computer and use it in GitHub Desktop.
learn and dive deep into Java Course. Arithmetic Operators Part 1 lecture
public class Main {
/*
+, -, *, /, %, ++, --
*/
public static void main(String[] args) {
int x = 8;
double y = 5;
//double addition = x + y;
int addition = (int) (x + y);
System.out.println("addition result: " + addition);
//int subtraction = (int) (x - y);
double subtraction = x - y;
System.out.println("subtraction result: " + subtraction);
//double multiplication = x * y;
int multiplication = (int) (x*y);
System.out.println("multiplication result: " + multiplication);
int num1 = 8;
double num2 = 5;
double division = num1 / num2;
System.out.println(division);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment