第二次上机练习

package Desk;
import java.util.*;
public class fest{
 
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
        System.out.println("请输入m的值:");
        int m = input.nextInt();
        if (m == 1) {
            System.out.println("m=1");
        } else if(m == 5) {
            System.out.println("m=5");
        } else if(m == 10) {
            System.out.println("m=10");
        } else {
            System.out.println("m=none");
        }
}
}

  

package Desk;
import java.util.*;
public class fest {
 
public static void main(String[] arges){
package Desk;
import java.util.*;
public class fest{
 
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.println("请输入一个整数:");
int n=input.nextInt();
  if(n%5==0&&n%6==0){
  System.out.println(n+"能被5和6整除");
  }else if(n%5==0){
  System.out.println(n+"能被5整除");
  }else if(n%6==0){
  System.out.println(n+"能被6整除");
  }else{
  System.out.println("不能被5或者6整除");
  }
}
}

  

package Desk;
import java.util.*;
public class fest{

 public static void main(String[] args) {
  Scanner input=new Scanner(System.in);
  System.out.println("请输入分数:");
  int mark=input.nextInt();
  if(mark<=100&&mark>=90){
  System.out.println("A");
  }else if(mark<=90&&mark>=80){
  System.out.println("B");
  }else if(mark<=80&&mark>=70){
  System.out.println("C");
  }else if(mark<=70&mark>=60){
  System.out.println("D");
  }else if(mark<=60){
  System.out.println("E");
  }else if(mark<0||mark>100){
  System.out.println("分数无效");
  }
 }
}

  

package Desk;
import java.util.*;
public class fest {

 public static void main(String[] args) {
  Scanner input = new Scanner(System.in);
    System.out.print("输入 x:");
    int x=input.nextInt();
    System.out.print("输入 y:");
    int y=input.nextInt();
    System.out.print("输入 z:");
    int z=input.nextInt();
    int max=0;
    int mid=0;
    int min=0;
    if(x>y&x>z) {
     System.out.println(max=x);
    }else if(y>x&y>z) {
     System.out.println(max=y);
    
    }else {
     System.out.println(max=z);
     }
    if(x<y&x<z) {
     System.out.println(min=x);
    }
     else if(y<x&y<z) {
      System.out.println(min=y);
      
     }else {
      System.out.println(min=z);
     }
    if(x<y&x>z||x<z&x>z) {
     System.out.println(mid=x);
    }else if (y<x&y>z||y>x&y<z) {
     System.out.println(mid=y);
    }else {
     System.out.println(mid=z);
    }
    System.out.println(min+""+mid+""+max);
   }
}

  

Scanner input=new Scanner(System.in); System.out.println("请输入一个数:"); int x =input.nextInt(); switch(x){ case 1: System.out.println("x=1"); break; case 5: System.out.println("x=5"); break; case 10: System.out.println("x=10"); break; default: System.out.println("none"); break; } } }

  

posted @ 2020-03-26 12:17  Demens  阅读(106)  评论(0编辑  收藏  举报