Java第一次作业

1.输出学号班级和姓名

package A;

public class XingMing {
    public static void main(String[] args) {
        System.out.println("计算机1902 11 李芊");
    }
}

 

package A;

public class TuXing {
    public static void main(String [] args) {
        for(int a = 1;a<=3;a++){
            for(int b = 1;b<=(3-a);b++){
                System.out.print(" ");
            }
            for(int c = 1;c<=2*a-1;c++){
                System.out.print("*");
            }
            System.out.print("\n");
        }
        for(int a =2;a>=1;a--) {
            for(int b = 2;b>=a;b--){
                System.out.print(" ");
            }
            for(int c = 1;c<=2*a-1;c++){
                System.out.print("*");
            }
            System.out.print("\n");
        }
    }
}

  

package A;

public class Sum {
    public static void main(String[] args) {
        int a = 5;
        int b = 8;
        System.out.println(a*a + b*b);
        System.out.println((a+b)*(a+b));
    }
}

  

 

posted @ 2021-03-05 11:07  李芊  阅读(192)  评论(0编辑  收藏  举报