题目
This is a question about java,I need some help!
Write a program that asks the user for three floating point (decimal) numbers and prints the three numbers in sorted order.For example:
Please enter three numbers:
4
9
2.5
The numbers in sorted order are
2.5
4
9
wo cong lai mei zuo guo a ,bu zhi dao zm zuo a ,wo ye bu xiang da yingwen ke shi zhe dian nao mei zhong wen de shu ru fa ,qiu bang zu
Write a program that asks the user for three floating point (decimal) numbers and prints the three numbers in sorted order.For example:
Please enter three numbers:
4
9
2.5
The numbers in sorted order are
2.5
4
9
wo cong lai mei zuo guo a ,bu zhi dao zm zuo a ,wo ye bu xiang da yingwen ke shi zhe dian nao mei zhong wen de shu ru fa ,qiu bang zu
提问时间:2020-08-01
答案
这问题确实不难,多看看书上的
import java.util.Arrays;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
int i = 3;
int[] list = new int[3];
System.out.println("please Please enter three numbers:");
for (int j = 0; j < i; j++) {
Scanner sc = new Scanner(System.in);
String t = sc.next();
list[j] = Integer.parseInt(t);
}
Arrays.sort(list);
System.out.println("The numbers in sorted order are:");
for (int k :list) {
System.out.println(k);
}
}
}
import java.util.Arrays;
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
int i = 3;
int[] list = new int[3];
System.out.println("please Please enter three numbers:");
for (int j = 0; j < i; j++) {
Scanner sc = new Scanner(System.in);
String t = sc.next();
list[j] = Integer.parseInt(t);
}
Arrays.sort(list);
System.out.println("The numbers in sorted order are:");
for (int k :list) {
System.out.println(k);
}
}
}
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
最新试题
热门考点
- 1大城市的人行道上有一条专门提供盲人行走的窄道上面有凸出的纹路,这样的道路叫--
- 2中国60周年和改革开放带来什么?发生哪些变化?
- 3一只标有6v 3W的灯泡 接在18V的电源使其正常发光要串联一个多大的电阻?此时电阻的消耗功率多大?
- 4when did their class meeting again
- 5以M带头的英文单词,And we also have M Party.
- 6people drive cars on earth. 有什么错误
- 7已知一个三角形的三条边相等,它三个角的度数是多少?
- 8已知方程x^2+y^2-2(t+3)x+2(1-4t^2)y+16t^4+9=0的图形是圆
- 9Does he have two English books?变为陈述句
- 10西西伯利亚平原的平均海拔