【笔试题】简单的两道笔试题(1、打印杨辉三角;2、三个数排序)
生活随笔
收集整理的這篇文章主要介紹了
【笔试题】简单的两道笔试题(1、打印杨辉三角;2、三个数排序)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
筆試題 簡單的兩道筆試題(1、打印楊輝三角;2、三個數排序)
1、打印楊輝三角
2、三個數排序(輸入3個數a,b,c,按大小順序輸出。)
import java.util.Scanner; public class ThreeSort {public static void main(String[] args) {Scanner scan = new Scanner(System.in);int a = scan.nextInt();int b = scan.nextInt();int c = scan.nextInt();if(a<b) {int temp = a;a = b;b = temp;}if(a<c) {int temp = a;a = c;c = temp;}if(b<c) {int temp = b;b = c;c = temp;}scan.close();System.out.print("從大到小的順序輸出:");System.out.println(a+" "+b+" "+c);} }轉載于:https://www.cnblogs.com/hglibin/p/9469404.html
總結
以上是生活随笔為你收集整理的【笔试题】简单的两道笔试题(1、打印杨辉三角;2、三个数排序)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Eclipse Git 克隆项目的时候出
- 下一篇: java 枚举类型enum