欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

java 輸入3個(gè)數(shù)a,b,c,按大小順序輸出的實(shí)例講解

 更新時(shí)間:2018年07月14日 09:08:02   作者:哦_也好  
今天小編就為大家分享一篇java 輸入3個(gè)數(shù)a,b,c,按大小順序輸出的實(shí)例講解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

題目:

輸入3個(gè)數(shù)a,b,c,按大小順序輸出。

代碼:

import java.util.Scanner;
public class lianxi34 {
public static void main(String[] args) {
 Scanner s = new Scanner(System.in);
 System.out.println("請(qǐng)輸入3個(gè)整數(shù):");
 int a = s.nextInt();
 int b = s.nextInt();
 int c = s.nextInt();
  if(a < b) {
  int t = a;
  a = b;
  b = t;
 }
  if(a < c) {
  int t = a;
  a = c;
  c = t;
 }
  if(b < c) {
  int t = b;
  b = c;
  c = t;
 }
 System.out.println("從大到小的順序輸出:");
 System.out.println(a + " " + b + " " + c);
}
} 

以上這篇java 輸入3個(gè)數(shù)a,b,c,按大小順序輸出的實(shí)例講解就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論