Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Archives
Today
Total
관리 메뉴

게임 개발 메모장

39. 재귀함수 이진수 출력 본문

문제 해결력 훈련

39. 재귀함수 이진수 출력

Dev_Moses 2024. 1. 18. 22:08

 

#include <iostream>
#include <vector>

using namespace std;

void DFS(int n);

int main()
{
	int n;
	cin >> n;

	DFS(n);
}

void DFS(int n)
{
	int Result = n % 2;
	int Num = n / 2;

	if (n == 0)
	{
		return;
	}
	else
	{
		DFS(Num);
		cout << Result << " ";
	}
}

'문제 해결력 훈련' 카테고리의 다른 글

41. K진수 출력  (0) 2024.01.18
40. 이진트리 깊이우선탐색(DFS  (0) 2024.01.18
38. 재귀 함수 분석  (0) 2024.01.18
36. inversion sequence  (0) 2024.01.10
35. LRU  (0) 2024.01.10