1802 Wang Zhaoming exercise class on 3.26

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 voidmain (String [] args) { 
        Scanner SCA = new new Scanner (the System. in ); 
        System.out.println ( "Enter a number" );
         int A = sca.nextInt ();
         IF (A == 0 &&. 5% A% == 0. 6 ) { 
            System.out.println ( "this number can be divisible by 56" ); 
        } the else  IF (A 5% == 0 ) { 
            System.out.println ( "this number can be divisible by 5" ); 
        } the else  IF (A 6% == 0 ) { 
            System.out.println ( "this number may be divisible by 6" ); 
        } the else{ 
            System.out.println ( "this number is not divisible by 6 and 5" ); 
        } 
    } 

} 
Package HM; 

Import java.util.Scanner; 
// fourth question 
public class classPractice3_26_04 { 

    public static void main (String [] args ) { 
        Scanner SCA = new new . Scanner (the System in ); 
        System.out.println ( "score between input 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 ( "fail" );
             BREAK ; 
        
        default : 
            System.out.println ( "input error" );
             BREAK ; 
        } 
    } 

} 
Package HM; 

Import java.util.Scanner; 
// V title 
public class classPractice3_26_05 { 

    public static void main (String [] args) { 
        Scanner SCA   = new new Scanner (the System. in ); 
        System.out.println ( "enter number of three" );
                 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);

                    }
                }
    }

}

 

Guess you like

Origin www.cnblogs.com/wzm7282/p/12573247.html