给定程序中,函数fun的功能是:参数n中,各位中为偶数的数取出,并按原来从高位到低位的顺序组成一个新的数,并作为函数值返回。
例如,从主函数输入一个整数:27638496,函数返回值为:26846。
不得增行或删行,也不得更改程序的结构!
import java.util.Scanner;
class Calculator {
public int fun(int n) {
int x = 0, s, i;
int t;
s = n;
/********** found **********/
i = __1__;
/********** found **********/
while (__2__) {
t = s % 10;
if (t % 2 == 0) {
/********** found **********/
x = x + t * i;
i =__3__;
}
s = s / 10;
}
return x;
}
}
public class Main{
public static void main(String[] args) {
int n;
Scanner sc = new Scanner(System.in);
n = sc.nextInt();
Calculator calc = new Calculator();
System.out.println(calc.fun(n));
}
}