/home/toolbox/public_html/solutions/1/136/xx.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:
17 * Date:
18 * Purpose:
19 * Problem:
20 */
21
22 /*
23 * This template reads data until a terminating value is reached.
24 */
25
26 int num;
27
28 void init()
29 {
30 /* FUNCTION init */
31 } /* FUNCTION init */
32
33 void dump()
34 {
35 /* FUNCTION dump */
36 } /* FUNCTION dump */
37
38 int getInput()
39 {
40 /* FUNCTION getInput */
41 int dataReadFlag;
42
43 scanf(" %d ", &num);
44 dataReadFlag = (-1 != num);
45 return (dataReadFlag);
46 } /* FUNCTION getInput */
47
48 void process()
49 {
50 /* FUNCTION process */
51 int cnt2 = 0;
52 int cnt3 = 0;
53 int cnt5 = 0;
54 int tot;
55 int i;
56
57 tot = num;
58 while (0 == (tot % 2))
59 {
60 /* while */
61 cnt2++;
62 tot = tot / 2;
63 } /* while */
64 while (0 == (tot % 3))
65 {
66 /* while */
67 cnt3++;
68 tot = tot / 3;
69 } /* while */
70 while (0 == (tot % 5))
71 {
72 /* while */
73 cnt5++;
74 tot = tot / 5;
75 } /* while */
76 if (1 != tot)
77 {
78 printf("PROBLEM: tot (%d) is not1!\n", tot);
79 }
80 printf("(num %d) (tot %d) (2 %d) (3 %d) (5 %d)\n", num, tot, cnt2, cnt3, cnt5);
81
82 } /* FUNCTION process */
83
84 int main()
85 {
86 /* main */
87 int moreToDo;
88
89 init();
90 moreToDo = getInput();
91 while (moreToDo)
92 {
93 /* while */
94 process();
95 moreToDo = getInput();
96 } /* while */
97
98 return EXIT_SUCCESS;
99 } /* main */
100