<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2.  
  3. START
  4.  
  5. Ask the user to enter the number of pidgeys and the number of candies in their possession.
  6.  
  7. IF
  8.  
  9. The number of candies and pidgeys is not a positive whole number
  10.  
  11. THEN
  12.  
  13. Ask the user to enter a positive whole number for the number of pidgeys and candies in their possession
  14.  
  15. END IF
  16.  
  17. Candy Evolutions is derived by dividing the number of candies by 12
  18.  
  19. IF
  20.  
  21. The number of candy evolutions is less than the number of pidgeys
  22.  
  23. THEN
  24.  
  25. The total number of evolutions equals the number of candy evolutions
  26.  
  27. ELSE
  28.  
  29. The total number of evolutions equals the number of pidgeys
  30.  
  31. END IF
  32.  
  33. XP = number of evolutions * 1000
  34.  
  35. show the total number of XP that has been gained and the number of evolutions that are possible
  36.  
  37. END
  38.  
  39. */
  40.  
  41. int main (void)
  42. {
  43.    float Pidgeys, Candies, Evolutions, XP, CandyEvolutions;
  44.  
  45.    scanf("%f %f", &Pidgeys, &Candies);
  46.    if( (floor(Candies)!=Candies) || (floor(Pidgeys)!=Pidgeys) || (Pidgeys <1) || (Candies <1) ) /* The floor function returns the greater integer value to its smaller normal value */
  47.    {
  48.    printf("\n ERROR! Please enter a whole, positive number"); /* The error message to display when the user enters a non whole postive value for the inputs */
  49.    exit(0); /* Commands to exit when the code is successful and proceeds to the next formatted output */
  50.    }
  51.    CandyEvolutions = floor(Candies / 12); /* To get a positive whole number, the floor is used for the formula, in which candies are divided by 12 */
  52.    if (CandyEvolutions < Pidgeys) /* The condition IF is to show the different situation for the evolutions to either equal the number candy evolutions or pidgeys */
  53.    {
  54.    Evolutions = CandyEvolutions;
  55.    }
  56.    else
  57.    {
  58.    Evolutions = Pidgeys;
  59.    }
  60.    XP = Evolutions * 1000; /* The experience point "XP" is gained when the user evolves a pokemon and its then multiplied by a 1000 */
  61.    printf("\nYou can perform %.0f evolutions and gain %.0f XP", Evolutions, XP);
  62.    
  63.    }