zoukankan      html  css  js  c++  java
  • 3.26课上练习1802王兆明

    package hm;
    //第一题
    import java.util.Scanner;
    
    public class classPractice3_26_01 {
    public static void main(String[] args) {
        Scanner sca = new  Scanner(System.in);
            int a = 0;
        while(true){
            System.out.println("输入一个值");
            a = sca.nextInt();
            if(a==1){
                System.out.println(a);
            }else if(a==5){
                System.out.println(a);
            }else if (a==10) {
                System.out.println(a);
            }else{
                System.out.println("none");
            }
            
        }
    }
    }
    package hm;
    
    import java.util.Scanner;
    //第二题
    public class classPractice3_26_02 {
    
        public static void main(String[] args) {
            Scanner sca = new Scanner(System.in);
            System.out.println("输入一个数字");
            int a = sca.nextInt();
            switch (a) {
            case 1:
                System.out.println(a);
                break;
            case 5:
                System.out.println(a);
                break;
            case 10:
                System.out.println(a);
                break;
    
            default:
                System.out.println("none");
                break;
            }
        }
    
    }
    package hm;
    
    import java.util.Scanner;
    //第三题
    public class classPractice3_26_03 {
    
        public static void main(String[] args) {
            Scanner sca = new Scanner(System.in);
            System.out.println("输入一个数字");
            int a = sca.nextInt();
            if (a%5==0&&a%6==0) {
                System.out.println("这个数字可以被56整除");
            }else if(a%5==0){
                System.out.println("这个数可以被5整除");
            }else if(a%6==0){
                System.out.println("这个数可以被6整除");
            }else{
                System.out.println("这个数不能被5和6整除");
            }
        }
    
    }
    package hm;
    
    import java.util.Scanner;
    //第四题
    public class classPractice3_26_04 {
    
        public static void main(String[] args) {
            Scanner sca = new Scanner(System.in);
            System.out.println("输入1-100之间的分数");
            int a = sca.nextInt();
            switch (a/10) {
            case 9:
            System.out.println("A");
            break;
            case 8:
                System.out.println("B");
                break;
            case 7:
                System.out.println("C");
                break;
            case 6:
                System.out.println("D");
                break;
            case 5:
            case 4:
            case 3:
            case 2:
            case 1:
            case 0:
                System.out.println("不及格");
                break;
            
            default:
                System.out.println("输入有误");
                break;
            }
        }
    
    }
    package hm;
    
    import java.util.Scanner;
    //第五题
    public class classPractice3_26_05 {
    
        public static void main(String[] args) {
            Scanner sca  = new Scanner(System.in);
            System.out.println("输入三个数");
                    int  a = sca.nextInt();
                    int  b = sca.nextInt();
                    int  c = sca.nextInt();
                    if(a>b){
                        if(b>c){
                            System.out.println(a+","+b+","+c);
                        }else if(a<c){
                            System.out.println(c+","+a+","+b);
                        }else{
                            System.out.println(a+","+c+","+b);
        
                        }
                    }else if(b>a){
                        if(a>c){
                            System.out.println(b+","+a+","+c);
                        }else if(b<c){
                            System.out.println(c+","+b+","+a);
                        }else{
                            System.out.println(b+","+c+","+a);
    
                        }
                    }
        }
    
    }
  • 相关阅读:
    使用Android自定义格式的定义Button
    Java Binary Search
    非常成功的人会做的八件事
    Ubuntu12.04 安装java
    NetBeans 时事通讯(刊号 # 125 Nov 17, 2010)
    NetBeans IDE 7.0 Beta 发布
    关于 IPv6 你需要知道的 10 件事
    开始学习 Go
    开始学习 Go
    Quartz 1.8.4 发布
  • 原文地址:https://www.cnblogs.com/wzm7282/p/12573247.html
Copyright © 2011-2022 走看看