java基础问题求指教

import java.util.Scanner;
public class Luck{

public static void main(String[] args){
  System.out.println("请输入您的4为会员卡号");
    Scanner num = new Scanner(System.in);
    int number = num.nextInt();
    int a = number/1000; //千位
    int b = number/1000/100; //百位
    int c = number/100/10; //十位
    int d = number/10; //个位
    int e = a+b+c+d;
    System.out.println(e);
if(a+b+c+d>20){
   System.out.println("中奖");

}

    else{
   System.out.println("没中");

}

}
    }

假如我输入了5位数怎么写能通知出错并且提示???

查看回复