用js写三个数,让三个数从小到大排列
程序员文章站
2023-01-28 19:35:38
console.log('请输入三个数:'); let num1 = readline.question() - 0; let num2 = readline.question() - 0; let num3 = readline.question() - 0; let num4; if (num1 ......
console.log('请输入三个数:');
let num1 = readline.question() - 0;
let num2 = readline.question() - 0;
let num3 = readline.question() - 0;
let num4;
if (num1 > num2) {
num4 = num1;
num1 = num2;
num2 = num4;
}
if (num2 > num3) {
num4 = num2;
num2 = num3;
num3 = num4;
}
if (num1 > num3) {
num4 = num1;
num1 = num3;
num3 = num4;
}
console.log(num1 + '<' + num2 + '<' + num3);
上一篇: JS实现的透明度渐变动画效果示例