<mosaic.cnfolio.com>
PROGRAM
  1. /*PSUEDO CODE
  2.  
  3. START
  4. Take amount of pidgey and pidgey candy
  5. IF these are not whole integers
  6.    THEN The inputs are wrong
  7. END IF
  8. IF pidgey is less than 1 and/or candy is less than 12
  9.    THEN The inputs are too small
  10. END IF
  11. Evolutions equal 0
  12. IF pidgey is greater than or equal to candy divided by 12
  13.    THEN use candy divided by 12 as amount of evolutions that can be done
  14.    THEN take the difference between candy/12 and pidgey and call the number pidgey remainder
  15.    IF evolutions divided by 12 is greater than or equal to one
  16.       THEN add this number to the amount of evolutions that can be done
  17.       THEN multiply this number by 1000 for xp that can be earnt
  18.       ELSE IF candy divided bt 12 is greater than pidgey
  19.          THEN use pidgey value as amount of evolutions that can be done
  20.          THEN multiply this nuymber by 1000 for xp that can be earnt
  21.       END IF
  22.    END IF
  23. END IF
  24. Take the remainder of candys that won't be used for evolutions and call it candy remainder
  25. Give the value of (12 minus candy remainder) the name N
  26. WHILE remainder of pidgeys is greater than (N plus 1) and pidgey is greater than candy divided by 12
  27.    THEN add one to evolutions
  28.    THEN minus (N plus 1) from pidgey remainder
  29. END WHILE
  30.  
  31. END */
  32.  
  33.  
  34. #include <stdio.h>
  35. #include <math.h>
  36.  
  37. int main (void){
  38.  
  39. int N, X;
  40. float candy, pidgey, i, candyRemainder, pidgeyRemainder;
  41.  
  42. scanf("%f %f", &pidgey, &candy);
  43.  
  44. /*provide an error message when the input has a fractional part, and is not an integer.*/
  45. if(fmod((pidgey*10),10) != 0)
  46.    {
  47.       printf("Error, your input is invalid.\nEnding program\n\n");
  48.       return (0);
  49.    }   
  50. if(fmod((candy*10),10) != 0)
  51.    {
  52.       printf("Error, your input is invalid.\nEnding program\n\n");
  53.       return (0);
  54.    }
  55. /*provide an error message when the inputs are too small to calculate with.*/   
  56. if(pidgey < 1 || candy < 12)
  57.    {                                         
  58.       printf("Error, inputs too low\nEnding program");                                 
  59.       return (0);
  60.    }
  61. /*find the remainder of candys, and how many needed for another evolution*/
  62. fmod(candy,12) == X;
  63. X*12 == candyRemainder;
  64. 12-candyRemainder == N;
  65. /*when pidgey is the limiting factor for evolutions*/
  66. if(candy/12 >= pidgey)
  67.    {                                               
  68.       i = pidgey;
  69.       printf("The total XP you can get using Lucky Egg timer is %.0f000.", i);
  70.    }
  71. /*when candy is the limiting factor for evolutions*/
  72. if(candy/12 < pidgey)
  73.    {
  74.       i = candy/12;
  75. /*for every 12 evolutions add another evolution to total*/
  76.       if(candy/144 >= 1)
  77.          {
  78.             printf("The total XP you can get using Lucky Egg timer is %.0f000.", (candy/144)+i);
  79.          }
  80.       else printf("The total XP you can get using Lucky Egg timer is %.0f000.", i);
  81.    }
  82. /*optionally turn in 1 pidgey for 1 candy to make extra evolutions*/
  83. while(pidgeyRemainder > (N+1) && candy/12 < pidgey)
  84.    {
  85.       pidgey-(candy/12) == pidgeyRemainder;
  86.       printf("You have the option for more XP by turning in your pidgey pokemon.\n");
  87.       i++;
  88.       pidgeyRemainder - (N+1) == pidgeyRemainder;
  89.       N = 11;
  90.    }
  91. }