Arithmetic ( + - * / ** )
Try it yourself →Four basic operations and exponentiation.
Syntax
a + b, a ** b
Description
** is the exponentiation operator. Integer division truncates the decimal. The mod() function is used for remainder (no %).
Example
program h print *, 2 ** 10 print *, 7 / 2 end program h
Expected output
1024 3
When to use?
Calculations.
Common mistakes
- ⚠️ Use mod(a,b) instead of % for remainders.