第三次实验课代码

添加NumberCounter和EncryptDemo
This commit is contained in:
2025-09-19 18:34:36 +08:00
parent 84a699fc37
commit 1986bbbe3e
2 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import java.util.Scanner;
public class NumberCounter {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long num = sc.nextLong();
int[] hash = new int[10];
while(num>0){
hash[(int)(num%10)]++;
num/=10;
}
for(int i : hash)
System.out.print(i+" ");
System.out.println();
}
}