MCPcopy Create free account
hub / github.com/E869120/math-algorithm-book / main

Function main

codes/cpp/Code_2_01_4.cpp:8–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6string Answer = ""; // string �͕�����^
7
8int main() {
9 cin >> N; // ���͕���
10 while (N >= 1) {
11 // N % 2 �� N �� 2 �Ŋ������]��i��FN=13 �̏ꍇ 1�j
12 // N / 2 �� N �� 2 �Ŋ������l�̐��������i��FN=13 �̏ꍇ 6�j
13 if (N % 2 == 0) Answer = "0" + Answer;
14 if (N % 2 == 1) Answer = "1" + Answer;
15 N = N / 2;
16 }
17 cout << Answer << endl; // �o�͕���
18 return 0;
19}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected