+ 1
How to create simple calculator in java
4 odpowiedzi
+ 3
Use switch case and put functions like addition, subtraction, multiplication etc...
+ 1
The simplest calculator I know in java is with with help of if statements.
Like if choice == addition
Add inputs
This isn't the most efficient way but it is the simplest.
It only requires knowledge of java basics and if statements
+ 1
Algorithm:
1. Add inputs of 2 numbers
2. Add input of selected operator
3. Make branches for operators (and make second number condition (not equal to zero) for divide and module)
4. Print result.
Universal algorithm for imperative programming languages.
Requirements:
To know programming language basics (what is main function, input/output, variables, data types etc.)
0
Hi rod indi man ko kabalo