热门

最新

红包

立Flag

投票

同城

我的

发布
qq_54378007
☆NAGISA
4 年前
trueqq_54378007

public class ZXY1 { public static void main(String[] args) { int[] a = { 15, 9, 5, 10, 1, 5, 6, 3,4, 2 }; System.out.println("原始数组:"); for (int i = 0; i < a.length; i++) System.out.print(a[i] + " "); for (int i = 0; i < a.length; i++) for (int j = i; j < a.length; j++) { if (a[i] < a[j]) { int tmp = a[i]; a[i] = a[j]; a[j] = tmp; } } System.out.println("\n" + "排序后数组:"); for (int i = 0; i < a.length; i++) System.out.print(a[i] + " "); } }

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
输入身高体重,求体脂率源代码如下#include <stdio.h> int main() { float height,weight,index; printf("请输入身高(m),体重(kg):\n"); scanf("%f%f",&height,&weight); index=weight/(height*height); printf("体重指数为:%.2f\n",index); return 0; }
立即登录