1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import
java.util.Scanner;
public
class
A03 {
/**
* @param args
*/
public
static
void
main(String[] args) {
// TODO Auto-generated method stub
Scanner input =
new
Scanner (System.in);
System.out.println(
"请输入4位会员卡号:"
);
int
num=input.nextInt();
int
A=num%
10
;
int
Tem=num/
10
%
10
;
int
Hundreds=num/
100
%
10
;
int
Kbit=num/
1000
;
int
sum=A+Tem+Hundreds+Kbit;
System.out.println(
"会员卡号"
+num+
"各位之和:"
+sum);
}
}
|
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1420130