編寫函數(shù),其功能為把一個十進(jìn)制數(shù)轉(zhuǎn)換為其對應(yīng)的八進(jìn)制數(shù)。程序讀入一個十進(jìn)制數(shù),調(diào)用該函數(shù)實(shí)現(xiàn)數(shù)制轉(zhuǎn)換后,輸出對應(yīng)的八進(jìn)制數(shù)。 樣例輸入 9274 樣例輸出 22072樣例輸入 18 樣例輸出 22import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String num = Integer.toOctalString(n); System.out.PRintln(num); }}
新聞熱點(diǎn)
疑難解答
圖片精選