Skip to content

Instantly share code, notes, and snippets.

@rmg007
Created October 3, 2022 21:07
Show Gist options
  • Save rmg007/3a990cb8f6f405eac65d049968c14052 to your computer and use it in GitHub Desktop.
Save rmg007/3a990cb8f6f405eac65d049968c14052 to your computer and use it in GitHub Desktop.
learn and dive deep into Java. Arithmetic Operators Part 2 lecture
public class Main {
/*
+, -, *, /, %, ++, - -
*/
public static void main(String[] args) {
int x = 5;
int y = 2;
// modulo operator - % division remainder
int remainder = x % y;
System.out.println("remainder: " + remainder);
System.out.println(7 % 3);
int n = 5;
// ++ increment operator
n++;
System.out.println(n);
n = 10;
n--;
System.out.println(n);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment