<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. Psuedo Code:
  3.  
  4. START
  5. Obtain the number of Pidgey pokemon the player has.
  6. Obtain the number of Pidgey candies in the player's inventory.
  7.  
  8.   IF the number of Pidgey pokemon or Pidgey candies in the player's inventory is greater than 0, positive and an integer.
  9.     THEN
  10.         IF the value of Pidgey candies is greater than or equal to 12
  11.           THEN
  12.               Initialise the number of evolutions to zero.
  13.               Initialise EXP to zero.
  14.               WHILE Pidgies is greater than zero and Candies is greater than eleven.
  15.                    Decrease the number of Pidgey pokemon by one.
  16.                    Decrease the number of Pidgey candies by twelve.
  17.                    Increase the number of Pidgey candies by one.
  18.                    Increase EXP by one thousand.
  19.                    Increase the number of evolutions by one.
  20.               END WHILE
  21.               Display the EXP gained from using the Lucky Egg timer.
  22.               Display the number of evolutions that will take place using the Lucky Egg.
  23.               Display the number of Pidgey Pokemon that remain after the evolutions have taken place.
  24.               Display the number of Pidgey Candies that remain after the evolutions have taken place.
  25.                        IF the number of evolutions is equal to 70.
  26.                          THEN
  27.                              Display a message that the number of Lucky Eggs to be used is one.
  28.                        END IF
  29.                              IF the number of evolutions is greater than 70.
  30.                                THEN
  31.                                    Display a message that more than one Lucky Egg is to be used.
  32.                             END IF
  33.                                   IF the number of evolutions is less than 70.
  34.                                     THEN
  35.                                         Display that at least 70 Pidgey Pokemon and at least 771 Pidgey Candies are needed to gain maximum efficency of a single Lucky Egg.
  36.         END IF                               
  37.     ELSE
  38.         Display an error message stating that the player must have at least 1 Pidgey pokemon and at least 12 Pidgey candies in their inventory and that their two inputs must be greater than 0, positive and an integer.       
  39.         END IF
  40.   END IF
  41. END
  42. */
  43.  
  44. #include <stdio.h>
  45.  
  46. int main (void) /*int is used for all values as none of the values in these calculations can be a decimal.*/
  47. {
  48. int Pidgies;
  49. int Candies;
  50.    scanf ( "%d %d", &Pidgies, &Candies ); /*scanf used to sets the values of Pidgies and Candies to their respective input values.*/
  51.    
  52.         if ((Candies >= 12) && (Pidgies > 0)) /*&& is used to ensure that the input values are valid for the calculations.*/
  53.         {
  54.           int EXP = 0;
  55.           int Pokecount = 0;
  56.           while ((Candies > 11) && (Pidgies > 0)) /*While loop used for calculations as statements inside the loop might never be executed if inputted data is not within the required parameters.*/
  57.           {
  58.                Pidgies --;
  59.                Candies -= 12;
  60.                Candies += 1;
  61.                EXP += 1000;
  62.                Pokecount++;
  63.           }
  64.           printf ("The maximum amount of EXP gained from using a Lucky Egg is %d. \nThe number of evolutions that will take place is %d. \nThe number of Pidgey Pokemon you will have left is %d. \nThe number of Pidgey Candies you will have left is %d.", EXP, Pokecount, Pidgies, Candies); /*Displays the finished calculations*/
  65.           if (Pokecount == 70)
  66.             {
  67.             printf("\nThe number of Lucky Eggs to be used in these evolutions is one.");
  68.             }
  69.           if (Pokecount > 70)
  70.             {
  71.             printf("\nMore than one Lucky Egg should be used for these evolutions.");
  72.             }
  73.           if (Pokecount < 70)
  74.             {
  75.             printf("\nIt is recommended to have at least 70 Pidgey Pokemon and at least 771 Pidgey Candies to gain maximum efficency of a single Lucky Egg.");
  76.             }
  77.         }
  78.         else /*if else statement used as there can only be two senarios for the input variables.*/
  79.         {
  80.             printf("Error:\nYou must have at least 1 Pidgey pokemon and at least 12 Pidgey candies.\nYour input two values must be posistive and an integer.");
  81.         }
  82. }