Geek攻城猫
2018-04-11 08:42:44浏览 1934
import java.util.Scanner;
public class reward {
public static void main(String[] args) {
int cardnumber;
System.out.println("请输入会员卡卡号末四位数字:");
Scanner input = new Scanner(System.in);
cardnumber= input.nextInt();
int gewei = cardnumber% 10;
int shiwei = cardnumber/ 10 % 10;
int baiwei = cardnumber/ 100 % 10;
int qianwei = cardnumber/ 1000;
int sum = gewei + shiwei + baiwei + qianwei;
System.out.println("会员卡号末位四位数字" + cardnumber + "各位之和: " + sum);
boolean isLuck=sum>20;
System.out.println("该用户是幸运客户吗?" +isLuck);
}
}