11.20作业第十三次 数组
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | public class we { public static void main(String[] args) { int [] arr= new int [ 30 ]; arr[ 0 ]= 1 ; arr[ 1 ]= 1 ; for ( int i= 2 ;i<arr.length;i++) { arr[i]=arr[i- 1 ]+arr[i- 2 ]; } for ( int i= 0 ;i<arr.length;i++){ System.out.println(arr[i]); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | public class nh { public static void main(String[] args) { int [] arr={ 23 , 234 , 3 , 1 , 19 , 21 , 231 , 88 , 90 , 11 }; for ( int i= 0 ;i<arr.length- 1 ;i++) { for ( int j=i+ 1 ;j< 10 ;j++) { if (arr[i]>arr[j]) { int temp; temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; } } } for ( int i= 0 ;i<arr.length;i++){ System.out.println(arr[i]); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | public class za { public static void main(String[] args) { int arr[]={ 23 , 234 , 3 , 1 , 19 , 21 , 231 , 88 , 90 , 11 }; for ( int i= 0 ;i<arr.length;i++) { for ( int j= 0 ;j<arr.length- 1 -i;j++) { if (arr[j]>arr[j+ 1 ]) { int temp; temp=arr[j]; arr[j]=arr[j+ 1 ]; arr[j+ 1 ]=temp; } } } for ( int i= 0 ;i<arr.length;i++){ System.out.println(arr[i]); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 | public class xx { public static void main(String args[]){ xc per[]= new xc[ 3 ]; per[ 0 ]= new xc( "叶修" , 25 ); per[ 1 ]= new xc( "苏沐橙" , 23 ); per[ 2 ]= new xc( "乔一帆" , 16 ); for ( int x= 0 ;x<per.length;x++) { per[x].getinfo(); } } } |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步