0 like 0 dislike
3.1k views
請設計一個程式,由使用者輸入一個十進位的數後再輸入想要轉換成的進位制,程式會將他轉換後輸出。

輸入說明:輸入的第一個數是一個十進位的數,接著會輸入一個正整數N代表要轉換的進位制。兩個數之間會用一個空白格開。

 

輸入範例:

10 16

輸出範例:

A
[Exercise] Coding (C) - asked in 2016-1 程式設計(一)AC by (18k points)
ID: 18066 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00

reshown by | 3.1k views

21 Answers

0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <string.h>

#include <ctype.h>

#include <math.h>

#include <stdlib.h>



int main(){

    int n,m,i=0,l;
** * **** * ** *** *** ** t[50];
** *** ** * * ** * ** *** * *** ** %d",&n,&m);
******* ** * * ** ** * * ** *** != 0){
* * * ** **** *** ** ** ** *** ***** ** **** >= m){
* * * *** ** * ** * *** ** * * * ** * ** * ** * * **** * *** *** * * = n%m;
*** * * **** * ****** ****** * * * ** * * *
* * ** * ** * * *** **** *** * *** * * ** * **
* * ** ***** * * ** *** * *** * * *** ** ** *** * *** **** ** ** ***** ** = n;
**** * * ** ** * ** ** * * * *
** * * ****** ***** * * ** * * ** ***** * * ** * 57){

// **** * ** *** *** * *** *** * ** ** ** * * **** *** ** ** ** * ** ***** *****
* ** * * * *** *** ** * *** **** ** * * * *** ** * ** ** *** = (t[i] +55);
* ** ***** * *** ** ** ******** * * ***** *****
* *** * *** *** * ** *** * * **** ** * *

// * * * * * *** ******* * ****** * * * **** * * **** ** * ** * * * * * *
*** * * * * ** ** * ** ******* * * * * ** * * * * * * *** *********** = (t[i] + '0');
***** * * * * *** *** * * * * **
** *** ** ** ** * * * *** * * * = n / m;
* * * * * ** * * ** ****** ** * * **

    }
* * * ** * ** * ** >= 0){
***** * ** *** * * *** * * ** ** ****** * ** * *** ***
* ***** * * * * ** *** * * ** * *

    }
* * *** * ** * ****** 0;

}
answered by (-216 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<ctype.h>

int main(void)

{

   int de,hex,A,B,C,D,E,F;
* * ***** ** * *** *** *** ** * ** * * *

   {
***** * ** * *** ** ** * * * *** *** * ** * * <= 9)
* ****** * ******* ** ** **** ** *** * * * ***
***** ** *** *** ****** ***** *** ** ** ** *** * *** *** * * * * ** * = de;
* * * *** * * * * **** ******* *** * * ** * * ****** ** *** ** * * * **** ***

        }
* * * * *** ****** *** * * ***** ******* * if(de == 10)
* ** ** *** *** * * ** * ******** * * **** * * * * * * *** * *****
* ** * * ** * ** * * ***** ** ** ** * * * * * if(de == 11)
** ** *** * ** ** * *** ** ** *** ** ***** ** * * * *** * * ** * **** *** * *
* * ** *** * ** * ** ** * **** * * ** **** ** if(de == 12)
* * * *** * * ** ** * **** ** ** *** * ** * *** *** ** ** * * ** ***** *** *
* * ** * ** * ** **** ** * * **** **** * * * if(de == 13)
* ***** * ** **** * **** ** ***** * **** * *** ** ** * * * * * * ****** ** * *
*** *** ** ** * * ** *** **** * * * * if(de == 14)
** **** * ***** ** * * **** ** ** ** ** **** ****** ***** * ** * ***** ** *****
* ** **** ** *** *** * ** * ******** ** ** if(de == 15)
* * ** ** ** ** * ** * *** **** * * * *** **** * ** **** * ** * ** *** *** **



   }







    return 0;

}
answered by (-320 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

#include <stdlib.h>



int main()

{

    int a,b,n;
** ******* ** ** * * * * *** * * * * * * * *

    if (a/b == 0)

    {
***** * ** * ***** * * * *** * *** * *** * * * *********
*** ******** * *** * * *** * ** * ** ** * ** * *** ** *** * * * * * **** * * *******
* * ** * * * *** * * * * *** * ** ** *** if (a == 10)
* ** ** **** ** *** *** * * * ** * * * * ***** ** * * ** ** **
**** ** * ** *** **** ** * *** * * ****** * ***** if (a == 11)
** * * *** ** **** * **** * * * * ** *** * ***** * ** ** *** *****
* * * * **** * **** * * ** *** ** * * if (a == 12)
* * * ** * *** * * ** * * * * * * *** * * *** ** * *** ** ** * * * * * * ***** * * *
* * ** * *** ** **** * *** ** * * if (a == 13)
** ** * * ** *** ******* * * * ** ** ** * * *** ** * ** * * * * ** *
* * ** ** ** ** ** **** ** ** ** ** * * ** **** if (a == 14)
*** * * ** * * ** * ** * * ** * ** ** * * ** * * * ** *
**** * * * **** * * * ** ******* **** * * * *** if (a == 15)
** * * ** *** *** ** ****** * *** *** * *** ** * ** *** * * ** * ***

    }

    else if (a/b != 0)

    {
* ** *** ** * ** * * ** *** * * ***** * (a/b == 0)
** * * * ** * *** *** * ** ** * *
* **** * * **** * ** ** * ** * ** *** **** * * ***** * * * * * **** * *** * * ** ** ** *
***** * *** * * * *** **** ** * ** ****** ** *** * * * ** * = n + 1;
** ** ***** ** * ***** ** *** **** * ***** *****
****** * *** ** * * * * ** *** ** * * ** * ** * * * * *

    }

    return 0;

}
answered by (-85 points)
0 like 0 dislike
Hidden content!
#include <stdio.h>

int main(void)

{
**** ** ** ** * * *** c;
* * **** * * *** ** * ** a,b;
** * * **** * *** * * ****** *** ** *
****** ** * ** * * * *** * * ****

    {
*** * * ** ** * * *** * ***** ** **** *** * **
* * * * * *** * **** ** *** * * * * * ** **** ** * * **


*** * *** * *** ** ** * * * * * *** ****** **** * *** *** *
** ** * *** * ** *** * ***** * * * *** * ** **** ** * **
*** ****** * ***** * * **

return 0;

}
answered by (-248 points)
0 like 0 dislike
Hidden content!
# include <stdio.h>

# include <ctype.h>

void change(int n,int m);

int main()

{
** * * ** ** n,m;
***** * ** * * ** ***** * *** * * * * ** *
* * ** * * ** **** * *

}



void change(int n,int m)

{
* * * * * ** * ** **
* * *** * ** ** * ** * ** * ******* *
** *** * * * *** * **** * **
** * * * ** * **
* *** * **** *** * * ** * * ** ***** ** ** *** ***** ***
* * * ** *** * *** *
** * ** ** * * ** * **
*** ** * *** ** *
* *** * ** ***** *** * ****** ** * * * ** ** ***** * *
** * * ** * ** * ** * **

}
answered by (-124 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>



int main(void)

{
**** * * * * *** ** a, b;
*** * *** ** *** * * ********* * *
* *** **** * * * * **
* * ***** * * ** * *** ** * * ** * ***** * ** * *
* * ** ** *** ** * * ***** ****
* * * * ** * ** ******* **** **** ** **** ****** ** * *


***** ** ** *** * * * ** * * ** ***** *
* * * * ** * * 0;

}
answered by (-114 points)
0 like 0 dislike
Hidden content!
#include<stdio.h>

#include<stdlib.h>



int main(void)

{
** * * * *** ** * *** a, b;
***** * ** * * * * ** ** * *** * ***** * * ***
* * *** ** * * * *
*** ****** * ** ** * *** * * ** * ** ** ** **
* ** *** *** * *** ** * ****
* * * ** * * ** * * ** ** ***** *** * ** * * * * *** *


* * ** ***** **** ** *** * ** * * * * *
* * * * ** * * * 0;

}
answered by (-114 points)
0 like 0 dislike
Hidden content!
//  Created by HoMingJui on 2016/11/3.

//



#include <stdio.h>

#include <stdlib.h>

#include <ctype.h>





int main(){

    int a=0,b=0,x[10]={0},i,xx=0;
* * ** *** ** ** ** * * d='A';
* ** ** ** *** *** * *** * * * %d",&a,&b);
**** * * ******** * *** ***
* ** ***** *** * * **** ** * *** * ** ** ** * *
* * ** **** ** *** ***** ** * ** ** * * * * ***** * ** * * * ** * ** *
* * ** * * * * ******** * ** * * *
* ** ***** **** *** ** * * * * ** *
*** * *** * * * ** ** **** * *** *** * * *** **** ** *** * *** *
* * * *** * * ** **** ** ** * * * * *** **** *** ****** *** * ** * ** **
* *** ***** ** * * * *** ** ***
* ***** * * * * * ***** * ***** * *** ********* ***

    }
*** * **** * * **** * * * ** * * * *
* * ** *** * ** **** ** * ** *** **** * *
** * ** * **** ** * * ** * * * * * * *** ** * *** * ** * * * ** *** ** *
* * ** ****** * * ** * * * * **** ***
****** ** ** ** * * * ** * * ********* ** *** *** * *
** * *** *** * **** * ***** * ***** * * * *** * * *** * ** **** * ** *** ***
* * ** * * * * ** ** * * * * * * * ***

    }
* ** **** * * ** 0;

}
answered by (-126 points)
0 like 0 dislike
Hidden content!
//  Created by HoMingJui on 2016/11/3.

//



#include <stdio.h>

#include <stdlib.h>

#include <ctype.h>





int main(){

    int a=0,b=0,x[10]={0},i,xx=0;
* * * * ** * ** * ** *** d='A';
* ** *** * ** * ** * * %d",&a,&b);
** * * * *** * * ** * * ***** *
* ** * * * * **** * ** * * * ** ** **** ****
* *** * * * * * * *** * * * *** * *** * * * ** ** ** *
* * **** * * ** ** * * * * **** **** * *
****** ** ** * * *** ** * **** ** * *** * *
* ** *** * * * *** * * *** *** * ** ***** * * * * *** ** ** ** * *
* ** * ** ******* * * ** * * ******** * * * * ** *** ** *** *** *****
**** * * * ** * ***** *** *** *** ** ***
** **** * ***** ***** *** * ** * * * ****

    }
* * ***** *** * * **** ** *** *
** ** ** ** * * **** * *** ** ** ** ** *****
*** * * *** *** ** ** * ** **** * * *** * * * ** * * * * * * ***** ** *** * * * *** ** ** ** **
* ** * * * *** * ** * *** * * *** *** * * * * **
* * *** ** * **** ** * * ** *** **** ** ** * **
*** * * * *** **** * * * * *** * * *** *** **** ***** *** * *** ** *** ** ** ** *
**** ** * * ** **** * * * *** ** * * * ** * * **

    }
**** ** *** ** * * ** * * 0;

}
answered by (-126 points)
0 like 0 dislike
Hidden content!
** * ** * * ***
* * * * ** * ** *

int main( )

{

int a,b;
* ** **** * ** * ** **
** * *** * ****

printf("0");

if(a==1&&b==2)

printf("1");

if(a==0&&b==4)
* * * * ***

if(a==1&&b==4)
*** ** *** ** ** *
****** **** *
*** ** * *

if(a==3&&b==4)
** * * *** ****

if(a==0&&b==8)
*** * * ** * ***** * *** *
** * *** * * **
** ** *** **
* * * * * ** * *
****** ** *
* * * **** * ** **
** *** * **
** *** * ** *
** *** ** * ** **
* * * *** * * ***
** ** * ** * **
**** ******* * * **
* ** *** ** **
** ** **** ** ***
* ** * * * ** *
* ** * * ******

if(a==1&&b==8)
** ** * * ***

if(a==2&&b==8)
* * * ** * * ** *

if(a==3&&b==8)
* ** *** *** * **** *

if(a==4&&b==8)
* * ***** ** ****

if(a==5&&b==8)
** ** *** * * **

if(a==6&&b==8)
* *** ** * * * ***
* * * ** * *
* ** * *** * ** ** *
*** * *** *** * *
* **** ********** * *
** * **** *** ** *
** ***** * *
** * * * ** * ** *
*** * * * * **
* *** * * * * **
** * * *
* *** * *** ***
* * * ** **** * * *
**** **** ******* *
* ** *** **** * * *
** ****** * * **** * * *
** **** ** *
* * * * ***** ** * ***
* * * * ** **
***** ** ****
** ** * ** ***
** ******* **** ** *
*** ** * ** ** *
* **** *** * * * *
** ****** *
* * *******
* * ***** ** **
** ** **
** *** * **
*********** * **** **
** *** *
** ***** *
* ** * ***
**** ** * * *** *
* * * * * * *** *





return 0;





}
answered by (42 points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.130.81
©2016-2025

Related questions

0 like 0 dislike
16 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18075 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 2.7k views
0 like 0 dislike
86 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18071 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 8.7k views
0 like 0 dislike
49 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18070 - Available when: Unlimited - Due to: Unlimited
| 5.1k views
0 like 0 dislike
62 answers
[Exercise] Coding (C) - asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18067 - Available when: 2016-12-01 18:30:00 - Due to: 2016-12-01 21:00:00
| 7k views
0 like 0 dislike
0 answers
[Resource] asked Dec 1, 2016 in 2016-1 程式設計(一)AC by Shun-Po (18k points)
ID: 18085 - Available when: Unlimited - Due to: Unlimited
| 10 views
12,783 questions
183,442 answers
172,219 comments
4,824 users