6 喜歡 0 不喜歡
606 瀏覽

Write a program to convert decimal number (<256) to binary. Use +-*/% operations only. Loops are not permitted

Example input:

50

Example output:

110010

 

[正常] Coding (C) - 最新提問 分類:Introduction to Computer Programming I (C) | 用戶: (12.1k 分)
ID: 27170 - 從幾時開始: 無限制 - 到幾時結束: 無限制

標籤修改 用戶: | 606 瀏覽

1個回答

0 喜歡 0 不喜歡
內容已隱藏
#include<stdio.h>



int main() {
** * ** * * * * * * * n[8], a[8];
** ******* * *** *** * *** * ** ** &n[7]);
* * * ******** ** * **** ****** ** *
** * ** * ** ** * ** *
* * * ** * * * ** *
******* * ** * * * * * * *** * *
** * * ***** ******** * * * *
* * **** * *** *** **
* * *** * ** ** ** **
*** *** ** ****** * *** ** ****
** * * * ** ** * ** ** * *
* * *** **** *** ***** *** ** * *
* ****** *** * ** * * ** **
** * * * * * *** * *** *** **
** ** * ***** ***** **
* * * ** *** * * * ** * *
* * *** ** ****** **** * * *
**** ** ** * * * ** *** * {
** * *** * ***** * *** * * * * ******** *** ** ** * * * ** a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]);

    }
* * * *** *** * * *** * if(a[1]!=0) {
* ******* * ** * * *** ** ***** ** ** * ** * *** * *** ** * **** a[1], a[2], a[3], a[4], a[5], a[6], a[7]);

    }
*** * **** *** * * ** * if(a[2]!=0) {
** * * * ***** ** * * ** ** **** ** ** ** ******* * * *** ** a[2], a[3], a[4], a[5], a[6], a[7]);
* * *** ** *** ** *
** ** * *** **** ** ** * * if(a[3]!=0) {
***** *** * ** * *** * ** * *** *** * ** * ** ******* * * * a[3], a[4], a[5], a[6], a[7]);
** * * * *** * * *
* * * ** * * **** * * * ** ** * if(a[4]!=0) {
* * ** * ** ** ** * * ** * * * * ** *** * * * * * ****** a[4], a[5], a[6], a[7]);

    }
** *** * ** * * ***** * if(a[5]!=0) {
* * ********* * * * ** *** * * * * ** * *** * * * * * * a[5], a[6], a[7]);
* ** * * ** * * * * ***
** * ** * *** * * * * if(a[6]!=0) {
**** ***** * * ***** * ** **** **** * ** * * * ** * a[6], a[7]);
**** * ** * * ** ** * ***
* ** ** *** ** **** * * if(a[7]!=0) {
* *** * * * **** *** * * * * *** * * * * ** ** * * ** ** ** a[7]);
*** ** * ** ****** * ** * *

}
最新回答 用戶: (-120 分)
0 0
Case 0: Correct output
Case 1: Correct output
Case 2: Correct output
Case 3: Correct output
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.6.217
©2016-2025

相關問題

6 喜歡 0 不喜歡
3 回答
[正常] Coding (C) - 最新提問 10月 16, 2017 分類:Introduction to Computer Programming I (C) | 用戶: thopd (12.1k 分)
ID: 27167 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 822 瀏覽
6 喜歡 0 不喜歡
0 回答
[正常] Coding (C) - 最新提問 10月 16, 2017 分類:Introduction to Computer Programming I (C) | 用戶: thopd (12.1k 分)
ID: 27171 - 從幾時開始: 無限制 - 到幾時結束: 無限制
| 570 瀏覽
12,783 問題
183,442 回答
172,219 留言
4,824 用戶