<mosaic.cnfolio.com>
PROGRAM
  1. START
  2. Obtain number of pidgeys and pidgey candy
  3. Display number of pidgeys and pidgey candy
  4.   IF number of pidgeys is less than or equal to zero
  5.     Display error message
  6.   WHILE number of pidgeys is more than zero and number of pidgey candy is more or equal to 12
  7.     Calculate how much experience is gained
  8.      Display the amount of experience gained with the remainder
  9. ELSE IF number of pidgeys is greater than 0 but the number of pidgey candy is less than 12
  10.      Display  message saying not enough candies
  11. ELSE IF number of pidgeys is less than or equal to 0 but the number of pidgey candy is more than or equal to 12
  12.      Display message saying no pokemon to evolve
  13. ELSE IF number of pidgeys is equal 0 and  the number of pidgey candy is equal to 0
  14.      Display error message
  15. ELSE IF number of pidgeys is less than 0 or the number of pidgey candy is less than 0
  16.      Display error message
  17. ELSE display error message
  18. END
  19.  
  20.  
  21. #include <stdio.h>
  22.  
  23.                                       /*using a lucky egg gives 2 times the experience. thus giving 1000xp*/
  24.  
  25. int experience(int,int);              /*this function is to calulate the experience gained and calculte the remaining candies*/
  26.  
  27. int main()                            /*calls the main function*/
  28.  
  29. {
  30. int pidgeys;
  31. int pidgey_candy;
  32.  
  33. scanf("%d %d", &pidgeys, &pidgey_candy);          /*scans the input values provided*/
  34. printf("You currently have %d pidgeys and %d pidgey_candy \n", pidgeys, pidgey_candy);
  35. experience(pidgeys, pidgey_candy);                /* calls int experience(int,int) function*/
  36.  
  37. }
  38.  
  39. int experience(int pidgeys, int pidgey_candy)     
  40. {
  41. int evolutions = 0;
  42. if(pidgeys > 0 && pidgey_candy >= 12)           /*if the statement is true, the function is activated*/       
  43. {
  44.  
  45. while (pidgeys > 0 && pidgey_candy >= 12)       /*while this statement is true, the arithmetic function is activated*/
  46. {
  47.     pidgey_candy = pidgey_candy-12;             /*subtracts 12 from the input value for pidgey_candy*/
  48.     pidgeys--;                                  /*decrements the total amount of pidgeys by 1*/
  49.     evolutions++;                               /*adds 1 to the total amount of evolutions occured*/
  50. }
  51.    
  52.     printf("Using a lucky egg, you have gained %d experience with a remainder of %d candies \n",evolutions*1000, pidgey_candy);
  53. }
  54.  
  55.  else if  (pidgeys > 0 && pidgey_candy < 12) printf("You dont have enough candies to evolve your pidgeys");     /*if statement is true, prints the given response*/
  56.         else if (pidgeys <= 0 && pidgey_candy >= 12) printf("You have enough pidgey candies but no pidgeys");    /*if statement is true, prints the given response*/
  57.             else if (pidgeys == 0 && pidgey_candy == 0) printf("You do not have the pokemon or the candy you are looking for");   /*if statement is true, prints the given response*/
  58.                 else if (pidgeys < 0 || pidgey_candy < 0) printf("ERROR");    /*if statement is true, prints the given response*/
  59.                     else printf("Please check your input values");         /*if statement is true, prints the given response*/
  60. }