/**
*
* @Title: test_draw_a_lottery_or_raffle
* @Description: 该方法的主要作用:输入四位数,各位数数字之和大于20 中奖,否则没中奖
* @param 设定文件
* @return 返回类型:void
* @throws
*/
@Test
public void test_draw_a_lottery_or_raffle(){
int curno = 0; //会员卡号
//输入会员卡号
System.out.println("请输入会员卡号,4位数:");
Scanner in = new Scanner(System.in);
curno = in.nextInt();
int ge = curno%10; //个位数
int shi = curno/10%10; //十位数
int bai = curno/100%10; //百位数
int qian = curno/1000; //千位数
curno = ge+shi+bai+qian;
if(curno>20){
//中奖了
System.out.println("恭喜你,中奖了!");
}else{
//没中奖
System.out.println("很抱歉,没中奖!");
}
}
判断个十百千位之后是否大于20 java——CSDN博客
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
将博客搬至CSDN
将博客搬至CSDN
csdn -
教你如何判断Java代码中异步操作是否完成
本篇文章将介绍几种常见的方法来判断Java代码中异步操作是否完成。
java 异步任务 异步操作