Considere o trecho de código fonte a seguir, escrito em linguagem Java.
public class Main {
public static void main(String[] args) {
double total = 0.0;
int temp, n;
temp = n = 153;
int qtdDigitos = 0;
while (temp > 0) {
qtdDigitos++;
temp = temp / 10;
}
temp = n;
while (temp > 0) {
int digito = temp % 10;
total += Math.pow(digito, qtdDigitos);
temp = temp / 10;
}
System.out.println((int)total);
}
}
Qual o resultado (saída) do programa acima?
Provas
Questão presente nas seguintes provas
Analista de Sistemas - Engenharia de Software
120 Questões