- 博客(6)
- 收藏
- 关注
原创 day01
import java.util.Scanner;public class Test { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String a = scanner.nextLine(); String[] str = a.split(" "); int left = 0; ...
2022-04-19 17:07:57 129
原创 打印水仙花数
public class TestDemo { public static void main(String[] args) { for (int i = 0; i < 999_999; i++) { int tmp=i; int count=0;//计算当前数字i有多少位 while (tmp!=0){ count++; tmp/=10;.
2022-04-09 14:39:47 55
原创 求最大公约数
import java.util.Scanner;public class TestDemo { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n1= scanner.nextInt(); int n2= scanner.nextInt(); int m=n2%n1; while (m!..
2022-04-09 14:12:26 40
原创 判断是不是素数
package ozz;import java.util.Scanner;public class TestDemo { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int n= scanner.nextInt(); int i = 2; for (; i < n; i++) { ..
2022-04-05 15:37:56 54
原创 实现模拟登录
编写代码模拟三次密码输入的场景。 最多能输入三次密码,密码正确,提示“登录成功”,密码错误, 可以重新输 入,最多输入三次。三次均错,则提示不能再输入。package ozz;import java.util.Scanner;public class TestDemo { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int count = 3
2022-04-05 13:50:30 149
原创 Java实现猜数字游戏
public class TestDemo { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); Random random = new Random(); int num = random.nextInt(100);//[0,100) while (true){ System.out.print.
2022-04-03 21:33:46 3016
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人