14354 - Number systems   

Description

輸入一個十進位的整數,並試著把它轉成八進位、十六進位並輸出。

 

由於還未教到輸入(input)的部分,因此請同學直接複製以下程式碼,並且實作輸出(output)的部分即可:

 

#include <stdio.h>

int main() {
  int num;
  scanf("%d", &num);

  //output (Write your code here)

  return 0;
}

 

Input

一個十進位的整數*num

 

Note:

0 <= *num <= 2147483647

Input

一個十進位的整數*num

 

Note:

0 <= *num <= 2147483647

 

Output

輸出符合以下格式:

Here are the three types of number system output:

 

  decimal:  *d

  octal: *o

  hexadecimal: *x or *X

 

 

Note:

  1.  *d, *o, *x, *X分別代表十進位八進位十六進位(小寫)十六進位(大寫)的表示

  2. 縮排空格為2格

  3. 輸出最後必須有一個換行符號(”\n”)

第一行輸出Here are the three...與第二行decimal:  *d中間有換行符號(”\n”)

Sample Input  Download

Sample Output  Download

Tags




Discuss