-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcollatz_recursive_prb.cpp
92 lines (65 loc) · 1.6 KB
/
collatz_recursive_prb.cpp
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# include <stdlib.h>
# include <stdio.h>
# include "collatz_recursive.h"
/******************************************************************************/
int main ( )
/******************************************************************************/
/*
Purpose:
MAIN is the main program for COLLATZ_RECURSIVE_PRB.
Discussion:
COLLATZ_RECURSIVE_PRB tests the COLLATZ_RECURSIVE library.
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
09 March 2012
Author:
John Burkardt
*/
{
timestamp ( );
printf ( "\n" );
printf ( "COLLATZ_RECURSIVE_PRB\n" );
printf ( " C version\n" );
printf ( " Test the COLLATZ_RECURSIVE library.\n" );
test01 ( );
/*
Terminate.
*/
printf ( "\n" );
printf ( "COLLATZ_RECURSIVE_PRB\n" );
printf ( " Normal end of execution.\n" );
printf ( "\n" );
timestamp ( );
return 0;
}
/******************************************************************************/
void test01 ( )
/******************************************************************************/
/*
Purpose:
TEST01 tests COLLATZ_PATH;
Licensing:
This code is distributed under the GNU LGPL license.
Modified:
09 March 2012
Author:
John Burkardt
*/
{
int n;
int n_test[5] = { 7, 8, 9, 10, 600 };
int test;
int test_num = 5;
printf ( "\n" );
printf ( "TEST01\n" );
printf ( " COLLATZ_PATH prints the members of a Collatz path.\n" );
for ( test = 0; test < test_num; test++ )
{
n = n_test[test];
printf ( "\n" );
printf ( " %d is the starting point.\n", n );
collatz_path ( n );
}
return;
}