/home/toolbox/public_html/solutions/124/12468/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: 2017-08-29
18 * Purpose: fun
19 * Problem: 12468
20 */
21
22 /*
23 * This template reads data until a terminating value is reached.
24 */
25
26 int a;
27 int b;
28
29 void init()
30 {
31 /* FUNCTION init */
32 } /* FUNCTION init */
33
34 void dump()
35 {
36 /* FUNCTION dump */
37 } /* FUNCTION dump */
38
39 int getInput()
40 {
41 /* FUNCTION getInput */
42 int dataReadFlag;
43 scanf(" %d %d ", &a, &b);
44 dataReadFlag = (-1 != a);
45 return (dataReadFlag);
46 } /* FUNCTION getInput */
47
48 void process()
49 {
50 /* FUNCTION process */
51 int tmp;
52
53 if (a > b)
54 {
55 tmp = a - b;
56 }
57 else
58 {
59 tmp = b - a;
60 }
61 if (50 > tmp)
62 {
63 printf("%d\n", tmp);
64 }
65 else
66 {
67 printf("%d\n", (100 - tmp));
68 }
69
70 } /* FUNCTION process */
71
72 int main()
73 {
74 /* main */
75 int moreToDo;
76
77 init();
78 moreToDo = getInput();
79 while (moreToDo)
80 {
81 /* while */
82 process();
83 moreToDo = getInput();
84 } /* while */
85
86 return EXIT_SUCCESS;
87 } /* main */
88