第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

3個(gè)int整數(shù)比較大小?

用布爾怎樣比較3個(gè)任意數(shù)的大小呢,不考慮循環(huán)和其他沒學(xué)過的知識(shí)

正在回答

3 回答

int a=40,b=21,c=12,d;

if(a>b){

d=a;

a=b;

b=d;

}

if(a>c){

d=a;

a=c;

c=d;

}

if(b>c){

d=b;

b=c;

c=d;

}

System.out.println("由小到大依次為:"+a+b+c)

0 回復(fù) 有任何疑惑可以回復(fù)我~

import java.util.*;

public class ThreeCompare {

public static void main(String[] args) {

int a, b, c;

Scanner input = new Scanner(System.in);

System.out.println("請(qǐng)輸入三個(gè)整數(shù):");

a = input.nextInt();

b = input.nextInt();

c = input.nextInt();

if (a > b) {

if (a > c) {

if (b > c) {

System.out.println(c + "<" + b + "<" + a);

} else {

System.out.println(b + "<" + c + "<" + a);

}

} else {

System.out.println(b + "<" + a + "<" + c);

}

} else {

if (a > c) {

System.out.println(c + "<" + a + "<" + b);

} else {

System.out.println(a + "<" + b + "<" + c);

}

}

}

}


1 回復(fù) 有任何疑惑可以回復(fù)我~

int ?a=12 ;

int ?b=23 ;

int ?c=3;

System.out.println(a>b);

System.out.println(a>c);

System.out.println(b>c);


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

3個(gè)int整數(shù)比較大?。?/h1> 我要回答 關(guān)注問題

微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)