Олимпиадный тренинг

Задача . 35994


Задача

Темы:
Refer to the following code fragment:
double answer = 13 / 5;
System.out.println("13 / 5 = " + answer);
The output is
13 / 5 = 2.0
The programmer intends the output to be
13 / 5 = 2.6

Which of the following replacements for the first line of code will not fix the
problem?

(A) double answer = (double) 13 / 5;
(B) double answer = 13 / (double) 5;
(C) double answer = 13.0 / 5;
(D) double answer = 13 / 5.0;
(E) double answer = (double) (13 / 5);

time 1000 ms
memory 32 Mb
Правила оформления программ и список ошибок при автоматической проверке задач

Статистика успешных решений по компиляторам
Комментарий учителя