用java 输入三个整数 按从小到大的顺序排列这三个整数
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/10 05:48:03
用java 输入三个整数 按从小到大的顺序排列这三个整数
那我给你一个用控制语句语句写的
public class Sort{
public static void main(String args[]){
Scanner in= new Scanner(System.in);
System.out.println("请输入3个整数:");
int a,b,c;
int max,other1,other2;
a=in.nextInt();
b=in.nextInt();
c=in.nextInt();
if(a>b&&a>c){
max=a;
other1=b;
other2=c;
}
else if(b>a&&b>c){
max=b;
other1=a;
other2=c;
}
else{
max=c;other1=a;other2=b
}
iif(other1>other2){
System.out.println(other2);
System.out.println(other1);
}
System.out.println(max);
}
}直接在网页上写的,你看看吧,希望你明白
public class Sort{
public static void main(String args[]){
Scanner in= new Scanner(System.in);
System.out.println("请输入3个整数:");
int a,b,c;
int max,other1,other2;
a=in.nextInt();
b=in.nextInt();
c=in.nextInt();
if(a>b&&a>c){
max=a;
other1=b;
other2=c;
}
else if(b>a&&b>c){
max=b;
other1=a;
other2=c;
}
else{
max=c;other1=a;other2=b
}
iif(other1>other2){
System.out.println(other2);
System.out.println(other1);
}
System.out.println(max);
}
}直接在网页上写的,你看看吧,希望你明白
输入三个整数,从小到大排列,用指针
java 1.编写程序,从命令行输入三个整数(整数的大小自己随意设置),从小到大排序并输出.要求在程序中
用c语言 编写函数对三个整数x,y,z 按从小到大的顺序排列,在主函数中调用它,然后输出排序后的三个数
输入三个整数a,b,c设计一个算法使得输入的三个整数按从小到大的次序分别存放在变量a,b,c中.
设计一个java程序,从键盘输入三个整数,按照从小到大的顺序输出
求C++解决问题:输入三个整数,要求将三个整数从小到大排列输出.
在java中怎么比较三个整数大小例如(a ,b,c);并从小到大输出
java编写程序输入3个整数排序.并按从小到大输出
编写程序,使任意输入的三个整数按从小到大的顺序输出.(先画框图,再写程序)
看不懂 输入三个整数 从小到大排列 看不懂意思 #includeusing namespace std;int main
给你三个整数,请你编一个程序计算这三个整数的和、乘积、平均数 输入三个整数(32位整型),中间有一个空
三个数从小到大排序的JAVA程序