数字特征编程

import java.util.*;

public class NEWDATECHARACTER {
public static void main(String[] args) {
// TODO 自动生成的方法存根
       Scanner in=new Scanner(System.in);
       System.out.println("Please input the date:");
int date=in.nextInt();
int temp=0;
int odate;
int i;
for(i=1;date!=0;i++){
odate=date%10;     //用odate更新每次date的个位十位百位
if(date%2==i%2)
temp=(int)(temp+Math.pow(2,i-1));     //用Math.pow求十进制temp
date/=10;                                       //不断更新date
}
System.out.println("The finally temp is:"+temp);
}


}

猜你喜欢

转载自blog.csdn.net/Mr_yuntuo/article/details/80763783