import java.util.Scanner; /** * @author 蓝色以太 * 幸运抽奖 */ public class LuckyDraw { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("请输入4位会员卡号:"); int num=sc.nextInt(); int ge=num%10; int shi=num%100/10; int bai=num/100%10; int qian=num/1000; int sum=ge+shi+bai+qian; System.out.println("会员卡号"+num+"各位之和:"+sum); } }
时间: 2024-10-05 11:05:15