js--从大到小排序a、b、c三个整数
作者:互联网
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>
<body>
</body>
<script type="text/javascript">
var a = prompt("输入一个数字a"),
b = prompt("输入一个数字b"),
c = prompt("输入一个数字c");
var max = parseInt(a);
if (b > a && b > c) {
max = parseInt(b);
}
if (c > a && c > b) {
max = parseInt(c);
}
var min = parseInt(a);
if (b < a && b < c) {
min = parseInt(b);
}
if (c < a && c < b) {
min = parseInt(c);
}
var sum = (parseInt(a) + parseInt(b) + parseInt(c)) - (parseInt(max) + parseInt(min));
document.write(max + "," + sum + "," + min);
</script>
</html>
标签:prompt,min,--,max,js,var,从大到,&&,parseInt 来源: https://blog.csdn.net/weixin_57550930/article/details/122040613