티스토리 툴바


#include <stdio.h>


void convert(int dec){

int base = 2; // can change the base such as 3, 4 and so on...

if(dec > 0){

convert(dec/base);

printf("%d", dec % base);

}

}


int main()

{

int dec;

scanf("%d", &dec);

convert(dec);


return 0;

}


'Programming > Algorithms' 카테고리의 다른 글

Decimal to Binary with recursive function  (0) 2009/12/17
Fibonacci  (0) 2009/12/12
atoi function  (0) 2009/12/08
Bubble Sort  (0) 2009/12/08
Selection Sort  (0) 2009/12/07
1~1000(혹은 특정한 수) 안의 소수 구하기  (0) 2009/12/06
1 2 3 4 5 ... 98