<mosaic.cnfolio.com>
PROGRAM
1. /*PSEUDO CODE
2.
3. START
4.          Obtain Number Of Pokemon
5.           Obtain Number Of Candies
6.    IF
7.          Number of Candies and Number of pokemon is less Then zero
8.    Then
9.          Display Error Message
10.    End IF
11.         Divide the number of candy by 12
12.          Obtain lucky Egg info Whether Yes or No
13.    IF
14.       Max pokemon is less then number of pokemon
15.    THEN
16.       can evolve pokemon is number of pokemon
17.    ELSE
18.       can evolve pokemon is max pokemon
19.    END IF
20.
21.        Display number of pokemon can evolve in given candy
22.    IF
23.       Lucky egg is Yes(Y)
24.    THEN
25.       Multiply can evolve pokemon with 2000
26.    ELSE
27.       Multiply By 1000
28.    END IF
29.       DISPLAY HOW MANY XP YOU EARN
30. END*/
31.
32.
33.
34. /*----PROGRAM----*/
35.
36.
37. #include <stdio.h>
38. #include <stdlib.h>
39.
40. int main()
41. {
42.     int numPid = 0;
43.     int candy = 0;
44.     int maxPid = 0;
45.     char luckyEgg;
46.     int xp = 0;
47.     int canEvolve = 0;
48.
49.     //taking in input information
50.     printf("How many Pidgey Pokemon do you have?\n");
51.     scanf("%d", &numPid);
52.
53.     printf("How many candies do you have?\n");
54.     scanf("%d", &candy);
55.
56.     //check if any values are invalid
57.     if(numPid < 0 || candy < 0) {
58.         printf("Input values must be larger then, or equal to zero.\nExiting...\n");
59.         return 0;
60.     }
61.         //how many pidgeys can we evolve (number of candies divide by 12)
62.     maxPid = candy / 12;
63.      scanf("%c", &luckyEgg);
64.
65.     //get info on lucky egg
66.     printf("Do you have lucky egg(Y/N)?");
67.     scanf("%c", &luckyEgg);
68.
69.
70.     //do we have enough candy to evolve all our pokemon, or can we do less?
71.     if(maxPid <  numPid)
72.         canEvolve = maxPid;
73.     else
74.         canEvolve = numPid;
75.
76.     printf("\nWith this ammount of candy, you can evolve \n%d Pokemon...\n", canEvolve);
77.
78.         if(luckyEgg == 'Y' || luckyEgg == 'y') {
79.             xp = canEvolve*2000;
80.         } else
81.             xp = canEvolve * 1000;
82.
83.     //Display final information
84.     printf("You can earn %d XP\n\n", xp);
85.
86.     return 0;
87. }