Professional Documents
Culture Documents
1.
output:
5
6
Pre-decrement Operator:
1. “--” is written before Variable name.
2. Value is decremented First and then decremented value is used in
expression.
Post-decrement Operator:
3. “--” is written after Variable name.
4. Value is used in expression first and then gets decremented.
output:
5
4
LOOPS:
You might be now wondering why loops?
You can now see the way we made use of for-loop and reduced the size of code.
Output:
JAVA
JAVA
JAVA
JAVA
JAVA
Both the codes gave us the same output but the code was written effectively
using for-loop.