• 第六次java作业


    public class fff{
    
        public static void main(String[] args) {
            Scanner sc=new Scanner(System.in);
           int[] arr=new int[5];
            for (int i = 0; i <=arr.length-1; i++) {
                arr[i]=sc.nextInt();
            }
            for (int i : arr) {
                System.out.println(i);
            }
            for (int j = 0; j < arr.length - 1; j++) {
                for (int k = 0; k <arr.length-1-j; k++) {
                    if(arr[k]>arr[k+1]) {
                        int a;
                        a=arr[k];
                        arr[k]=arr[k+1];
                        arr[k+1]=a;
                }
            }
        }
            for (int i : arr) {
                System.out.println(i);
            }
    }
    }
    public class fff {
    
        public static void main(String[] args) {
            Scanner sc=new Scanner(System.in);
            int[] x={34,22,35,67,45,66,12,33};
            System.out.println("请输入一个数:");
            int a=sc.nextInt();
            for(int i=0;i<x.length;i++){
                if(x[i]==a){
                    System.out.println("下标为"+i);
                }else{
                    System.out.println("not found");
                }break;
            }
        }
    }
    public class fff{
    public class fff {
    
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int[][] a = new int[5][4];
            int max=0;
            for (int i = 0; i < 3; i++) {
                for (int j = 0; j < 4; j++) {
                    a[i][j] = sc.nextInt();
                }
            }
            for (int i = 0; i < a.length; i++) {
                for (int j = 0; j < a[i].length-1; j++) {
                    if(max<a[i][j]){
                        max=a[i][j];
                    }
                }
            }
            System.out.println("最大值是:"+max);
        }
        }
    
    
    
    public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int[][] a = new int[5][4];
            for (int i = 0; i < 5; i++) {
                for (int j = 0; j < 4; j++) {
                    a[i][j] = sc.nextInt();
                }
            }
            System.out.println("你输入的数组为:");
            for (int i = 0; i < 5; i++) {
                for (int j = 0; j < 4; j++) {
                    System.out.print(a[i][j]);
                }
                System.out.println();
            }
  • 相关阅读:
    CSS躬行记(9)——网格布局
    CSS躬行记(8)——裁剪和遮罩
    CSS躬行记(7)——合成
    CentOS 系统目录解析
    Linux 命令快捷键
    秒的精确度
    Oracle和mysql中装逼dual表的用途介绍
    mysql 的mgr集群
    ansible笔记
    cygwin
  • 原文地址:https://www.cnblogs.com/fff1479/p/12697256.html
Copyright © 2020-2023  润新知