菜鸟学涂

来源:互联网 发布:引物设计软件 编辑:程序博客网 时间:2024/04/20 12:39

 请高手精简指导

 

 

 

public class Text217 {

 /**
  * 将成绩分等级
  */
 public static void main(String[] args) {
  Scanner sc=new Scanner(System.in);
  System.out.print("请输入您的成绩:");
    float score = sc.nextFloat();
         if(score>=90)
          System.out.println("您获得A,优秀!");
         else if(score>=80)
          System.out.println("您获得B,很棒!");
         else if(score>=70)
          System.out.println("您获得C,良好!");
         else if(score>=60)
          System.out.println("您获得D,刚及格!");
         else
          System.out.println("您获得E,要加油!");
 }

}

 

 

public class Text218 {

 /**
  *            
  *        打印以下图标
  *             *
                   **
                   ***
                   ****
                   *
                   **
                   ***
                   ****
  */
 public static void main(String[] args) {
 
  for(int t=0;t<2;t++){
  for(int i=1;i<5;i++){
   for(int j=0;j<i;j++)
    System.out.print("*");
  System.out.println();

 }
  }
}
}

 

 

 

 

import java.util.Scanner;

public class Text219 {
 /*
  *              1
                  1 2 1
                1 2 3 2 1
              1 2 3 4 3 2 1
            1 2 3 4 5 4 3 2 1
  */
 

 public static void main(String[] args) {
  int i;
  int j;
  int t;
  Scanner sc=new Scanner(System.in);
  System.out.println("请输入要打印的行数:");
  int line=sc.nextInt();
  
  for (i = line; i > 0; i--) {
   for (j = 1; j < i + 1; j++)
    System.out.print("  ");

   for (t = 0; t <= line+1 - j;) {
    t++;
    System.out.print(t+" ");
   }
   for (int r = 0; r < line+1 - j;) {
    r++;
    System.out.print((t - r)+" ");

   }
   System.out.println();
  }

 }
}

 

原创粉丝点击