<mosaic.cnfolio.com>
PROGRAM
1. /*START
2.
3. Insert values for Number of Pidgey and Number of Candies
4.
5.   IF
6.
7.    Number of Pidgey < 1 and/or Number of Candies < 12
8.
9.    THEN
10.
11.     display the following error messages respectively,
12.
13.      "Error! Not enough Pidgey"
14.      "Error! Not enough candies to evolve!"
15.
16.    ELSE
17.
18.     display
19.
20.       number of Pidgey capable of evolving,
21.       XP gained (calculated by: #of evolvable Pidgey*500*2),
22.       remaining Candy (if any)
23.       remaining Pidgey (if any),
24.       amount of Candy required to evolve the remaining Pidgey(if any),
25.
26.   ENDIF
27.
28. END*/
29.
30. #include <stdio.h>
31.
32. int main(void)
33. {
34.  int numberofPidgey, numberofCandy, possibleEvo, remainingPidgey, xpGained1, xpGained2, remainingCandy, requiredCandy, toomanyPidgey;
35.
36.  scanf("%d %d", &numberofPidgey, &numberofCandy);
37.
38.  possibleEvo = numberofCandy/12;
39.  requiredCandy = numberofPidgey*12;
40.  remainingPidgey = (numberofPidgey-possibleEvo);
41.  remainingCandy = (numberofCandy-requiredCandy);
42.  toomanyPidgey = (requiredCandy-numberofCandy);
43.  xpGained1 = (possibleEvo*500*2);
44.  xpGained2 = (possibleEvo+(numberofPidgey-possibleEvo))*500*2;
45.
46.  if (numberofCandy < 12)
47.  {
48.   printf("Error! Not enough candies to evolve!\n");
49.  }
50.
51.  if (numberofPidgey < 1)
52.  {
53.   printf("Error! You have no Pidgey!\n");
54.  }
55.
56.  if (numberofPidgey <= (numberofCandy/12))
57.  {
58.   printf("%d Pidgey can be evolved!\n", numberofPidgey);
59.   printf("%d XP gained!\n", xpGained2);
60.   printf("You have %d candies remaining.\n", remainingCandy);
61.  }
62.
63.  if (numberofPidgey > (numberofCandy/12))
64.  {
65.   printf("%d Pidgey can be evolved!\n", possibleEvo);
66.   printf("%d XP gained!\n", xpGained1);
67.   printf("You still have %d Pidgey left to evolve.\n", remainingPidgey);
68.   printf("To evolve the rest of the Pidgey, you need %d more candy.\n", toomanyPidgey);
69.  }
70.
71. }