Skip to main content

Advanced Arithmetic Operation

Math class (docs)

Math is a class that provides common mathematical operations:
  • Power and root
  • Logarithm
  • Max, Min
  • Trigonometry
  • Random
Program.java

Data Type: Integer and Double

Input

Basic Methods of Scanner

Reading Strings

One line

Reading Numners

Integer

Special Case

Special Case

Output Formatting

Too Many Trailing Digits!

Try use this!

System.out.printf()

  • System.out.format()
  • Example

Format Works

Format

Converters & Flags

Saving Formatted String in Variables

  • Example: