求各位帮帮我,脑子快炸了

img

img

2张图片上那么多题,具体哪道?

1 byte、short、int、long、float、double、boolean、char。
2

public static void main(String[] s) {
        int n, fac = 1, i;
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter a number: ");
        n = sc.nextInt();
        if ( n < 1 || n > 10 ) {
            System.out.println("无效数据");
            return;
        }
        for (i = 1; i <= n; i++) {
            fac *= i;
        }
        //输出最后的乘法运算式
        System.out.print(n+"!=");
        for (int j = n; j > 0; j--) {
            System.out.print("×"+j);
        }
        System.out.println("="+fac);
        sc.close();
    }

img

3

public static void main(String[] args) {
        int sum = 0;
        int j=0;
        //求和
        for(int i =1;i<=100;i++){
            if(i%3!=0){
                if(j==4){
                    j=0;
                    System.out.println();
                }
                System.out.print(i+"\t");
                sum=sum+i;
                j++;
            }
        }
        System.out.println();
        System.out.println("和是:"+sum);
    }

img


上机练习五

注释部分看你是否需要,就是看编号是否需要限制


public static void main(String[] args) {
        Scanner sc =new Scanner(System.in);
        System.out.println("请输入你要录入的用户信息数量:");
        int num = sc.nextInt();
        for (int i = 0; i < num; i++) {
            System.out.print("请输入用户的编号<4位整数>:");
            int bh = sc.nextInt();
            /*if(bh<1000  || bh>=10000){
                System.out.println("你的编号不是4位整数哟,录入失败,请重试。");
                i--;
                continue;
            }*/
            System.out.print("请输入用户的年龄:");
            int age = sc.nextInt();
            if(age<10){
                System.out.println("很抱歉,你的年龄不适合玩游戏。");
                System.out.println("录入信息失败");
                continue;
            }
            System.out.print("请输入你的会员积分:");
            int n = sc.nextInt();
            System.out.println("你录入的会员信息是:");
            System.out.println("用户编号:"+bh+"\t年龄:"+age+"\t会员积分:"+n);
        }
    }

img