/home/toolbox/public_html/solutions/9/900/a.c
1 #include <stdio.h>
2 #include <string.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <fcntl.h>
6 #include <stdint.h>
7 #include <math.h>
8 #include <stdlib.h>
9
10 #define TRUE (1 == 1)
11 #define FALSE (1 != 1)
12
13 #define DEBUG if (FALSE)
14
15 /*
16 * Author: Isaac Traxler
17 * Date: 2016-03-29
18 * Purpose: fun
19 * Problem: 900 - Brick Wall Patterns
20 */
21
22 /*
23 * This template reads data until a terminating value is reached.
24 */
25
26 #define CNT 50
27 #define ARRAY_SIZE 51
28
29 int num;
30 long long int fib[ARRAY_SIZE];
31
32 void init()
33 {
34 /* FUNCTION init */
35 int i;
36 int a;
37 int b;
38
39 fib[1]= 1;
40 fib[2] = 2;
41 for (i=3; ARRAY_SIZE>i; i++)
42 {
43 /* for */
44 fib[i] = fib[i-1] + fib[i-2];
45 } /* for */
46 } /* FUNCTION init */
47
48 void dump()
49 {
50 /* FUNCTION dump */
51 } /* FUNCTION dump */
52
53 int getInput()
54 {
55 /* FUNCTION getInput */
56 int dataReadFlag;
57
58 scanf(" %d ", &num);
59 dataReadFlag = (0 != num);
60 return (dataReadFlag);
61 } /* FUNCTION getInput */
62
63 void process()
64 {
65 /* FUNCTION process */
66 printf("%lld\n", fib[num]);
67 } /* FUNCTION process */
68
69 int main()
70 {
71 /* main */
72 int moreToDo;
73
74 init();
75 moreToDo = getInput();
76 while (moreToDo)
77 {
78 /* while */
79 process();
80 moreToDo = getInput();
81 } /* while */
82
83 return EXIT_SUCCESS;
84 } /* main */
85