<mosaic.cnfolio.com>
PROGRAM
1. /* Psuedo code
2.
3. START
4.
5. READ the number of pidgeys owned
6. READ the number of pidgey candies
7. WHILE number of candies owned is greater than 11
8. SUBTRACT 12 from the number of pidgey candies
9. INCREMENT the counter
10. END WHILE
11. ADD counter result to number of pidgey candies and label result value0
12. DIVIDE value0 by 12 and label result value1
13. MULTIPLY value 1 by 1000 and label result value2
14. MULTIPLY value 1 by 12 and label result value3
15. SUBTRACT value1 from number of pidgeys owned and label result value4
16. SUBTRACT value 3 from the number of pidgeys candies and label result value5
17. IF number of pidgeys candies is greater than 12
18. THEN
19.   IF number of pidgeys owned is greater than 0
20.    THEN
21.     IF value1 is LESS THAN or EQUAL to number of pidgeys owned
22.      THEN
23.       IF value1 is LESS THAN or EQUAL to 70
24.        THEN
25.         Display "XP gained = value2
26.         Pidgeys remaining = value4
27.         Candies remaining = value5"
28.        ELSE
29.       Display "XP gained = value2
30.       Pidgeys remaining = value4
31.       Candies remaining = value5
32.       You may need multiple lucky eggs to complete all evolutions"
33.      ELSE
34.     SUBTRACT number of pidgeys owned from value1 and label result value6
35.     MULTIPLY number of pidgeys owned by 1000 and label result value7
36.     Display "XP gained = value7
37.     Pidgeys remaining = 0
38.     Candies remaining = value5
39.     You could gain more XP by catching value6 more pidgeys"
40.    ELSE
41.   Display "You need at least 1 pidgey to evolve in order to gain XP"
42. ELSE
43. Display "You need at least 12 candies to evolve a pidgey"
44.
45. END
46. */
47.
48. #include <stdio.h>
49.
50. int main( void )
51. {
52.
53. int pidgey0, pidgey1, value0 , value1, value2, value3, value4, value5, value6, value7, counter;
54. scanf(" %d %d ", &pidgey0, &pidgey1);
55. counter = 0;
56. if (pidgey1 >= 12)
57. {
58. while (pidgey1 > 11)
59. {
60. pidgey1 = pidgey1 - 12;
61. counter++;
62. }
63. value0 = pidgey1 + counter;
64. value1 = value0 / 12;
65. value2 = value1 * 1000;
66. value3 = value1 * 12;
67. value4 = pidgey0 - value1;
68. value5 = pidgey1 - value3;
69.  if (pidgey0 > 0)
70.   if (value1 <= pidgey0)
71.    if (value1 <= 70)
72.     printf( " XP Gained = %d, Pidgeys Remaining = %d, Candies Remaining = %d ", value2, value4, value5);
73.    else
74.     printf( " XP Gained = %d, Pidgeys Remaining = %d, Candies Remaining = %d, However you may not be able to complete all evolutions in the span of a single Lucky Egg ", value2, value4, value5);
75.   else
76. {
77.    value6 = value1 - pidgey0;
78.    value7 = pidgey0 * 1000;
79.    printf( " XP Gained = %d, Pidgeys Remaining = 0, Candies Remaining = %d, You could gain more XP by catching %d Pidgeys ", value7, value5, value6);
80. }
81.  else
82.   printf( " You need at least 1 pidgey to evolve in order to gain any XP ");
83. }
84. else
85. printf( " You need at least 12 candies in order to evolve a Pidgey" );
86.
87. }