powered by simpleCommunicator - 2.0.49     © 2025 Programmizd 02
Форумы / Java [игнор отключен] [закрыт для гостей] / The task: Create a basic calculator with only 5 operations
4 сообщений из 4, страница 1 из 1
The task: Create a basic calculator with only 5 operations
    #39862529
cavidhesenov
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
сможте помочь?токой вопросик

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);
}
}
}

так на онлайн компиляторе работает но там где я сдал ответ на вопрос(на сайте) не принял ответ
...
Рейтинг: 0 / 0
The task: Create a basic calculator with only 5 operations
    #39862571
Дмитрий Мух
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
cavidhesenov,

а в чём собственно вопросик?
почему сайт не принял ваш ответ?

очевидно потому, что задача реализовать пять операций: +, -, *, /, %, - а не только деление
и написано, что при проверке будут изменятся значения переменных number1, number2, и operation
сами подумайте, что выведет ваш код при этом
...
Рейтинг: 0 / 0
The task: Create a basic calculator with only 5 operations
    #39862614
Alexey Tomin
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
cavidhesenovсможте помочь?

Нет. Ты не осилил тэг SRC
...
Рейтинг: 0 / 0
The task: Create a basic calculator with only 5 operations
    #39862616
PetroNotC Sharp
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Alexey Tomincavidhesenovсможте помочь?

Нет. Ты не осилил тэг SRC)) +1
...
Рейтинг: 0 / 0
4 сообщений из 4, страница 1 из 1
Форумы / Java [игнор отключен] [закрыт для гостей] / The task: Create a basic calculator with only 5 operations
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]