forked from damaohongtu/JavaInterview
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain_1.java
More file actions
34 lines (32 loc) · 849 Bytes
/
Copy pathMain_1.java
File metadata and controls
34 lines (32 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package BiShi.WeBank;
import java.io.File;
import java.util.Scanner;
/**
* @Author MaoTian
* @Classname Main_1
* @Description TODO
* @Date 下午4:32 2019/9/19
* @Version 1.0
* @Created by mao<[email protected]>
*/
public class Main_1 {
public static int helper(int n){
int res=1;
for (int i = 1; i <=n ; i++) {
res*=i;
while (res%10==0){
res=res/10;
}
res=res%10;
}
return res;
}
public static void main(String[] args)throws Exception {
Scanner sc =new Scanner(new File("/home/mao/workspace/面试/JavaGuide/JavaInterview/java/src/BiShi/WeBank/main_1"));
//Scanner sc =new Scanner(System.in);
while(sc.hasNext()){
int n=sc.nextInt();
System.out.println(helper(n));
}
}
}