|
The task: Create a basic calculator with only 5 operations
|
|||
---|---|---|---|
#18+
сможте помочь?токой вопросик public class Calculator { public static void main(String[] args) { int number1 = 15; int number2 = 3; String operation = "/"; // write your code here } } The task Create a basic calculator with only 5 operations, add, subtract, multiply, divide two numbers (and find the residue of dividing one by another. Variables number1 and number2 contain the numbers to be operated on.Variable operation contains the operation that needs to be performed on two numbers. Write a code that will display the result of the operation. Output example: Result: 5 You are not allowed to change the current values of the number1, number2, and operation variables - we will do it on server while checking your code. public class Calculator { public static void main(String[] args) { int number1 = 15; int number2 = 3; String operation = "/"; // write your code here if (operation=="/"){ System.out.println("Result: " + number1/number2); } } } так на онлайн компиляторе работает но там где я сдал ответ на вопрос(на сайте) не принял ответ ... |
|||
:
Нравится:
Не нравится:
|
|||
16.09.2019, 22:33 |
|
The task: Create a basic calculator with only 5 operations
|
|||
---|---|---|---|
#18+
cavidhesenov, а в чём собственно вопросик? почему сайт не принял ваш ответ? очевидно потому, что задача реализовать пять операций: +, -, *, /, %, - а не только деление и написано, что при проверке будут изменятся значения переменных number1, number2, и operation сами подумайте, что выведет ваш код при этом ... |
|||
:
Нравится:
Не нравится:
|
|||
17.09.2019, 08:38 |
|
The task: Create a basic calculator with only 5 operations
|
|||
---|---|---|---|
#18+
cavidhesenovсможте помочь? Нет. Ты не осилил тэг SRC ... |
|||
:
Нравится:
Не нравится:
|
|||
17.09.2019, 10:17 |
|
|
start [/forum/topic.php?fid=59&fpage=23&tid=2121120]: |
0ms |
get settings: |
10ms |
get forum list: |
16ms |
check forum access: |
5ms |
check topic access: |
5ms |
track hit: |
78ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
49ms |
get tp. blocked users: |
2ms |
others: | 237ms |
total: | 418ms |
0 / 0 |