<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. START
  3. Read the value for the number of inputted pidgeys
  4. Read the value for the number of inputted Pidgey Candies
  5. Set the value of EggXP to 1000
  6. Set the value of Required Candies to 12
  7. Set TotalXP to equil the vaule of Pidgey Candies divided by Required Candies and multiplied by EggXP
  8.  
  9. Pidgey Candies is equil Pidgey Candies plus the number of Pidgeys - 1
  10.  
  11. INPUT value for Pidgeys & Candies
  12. IF the vaule is 0 THEN
  13.    display an Error message
  14.    END
  15. END IF
  16.  
  17. IF Pidgey Candies is greater than Required Candies * Pidgeys THEN
  18.    Calculate (Pidgey * Required Candies / Required Candies * EggXP)
  19.    Display the Total XP
  20. Else
  21.    Calculate XP (Pidgey Candies / Required Candies * Egg XP)
  22.    Display Total XP
  23. END IF
  24.    IF Pidgeys less than 0 THEN
  25.       Calculate TotalXP and divide it by 1000
  26.       Display the number of pidgeys evolved
  27.    END IF
  28.  
  29. END
  30. */
  31.  
  32. #include <stdio.h>
  33. int main (void)
  34. { 
  35. /* I have stated that all my variables are going to be used in an intager format, meaning that i will be working with whole numbers*/
  36. int Pidgeys;
  37. int Candies;
  38. int EvolveCandies = 12;
  39. int EggXP = 1000;
  40. int TotalXP;
  41.  
  42. /*The Scanf function is telling the program to look for inputs and their values, i have assigned 2 variables that will be used for inputting data*/
  43. scanf("%d %d", &Pidgeys, &Candies);
  44. /*as well as inputting data for Candies there have to be left overs from each evolution and the formula bellow allows the program to take the additional candies and add them on to the total*/
  45. Candies = Candies + Pidgeys - 1;
  46. TotalXP =  Candies/EvolveCandies*EggXP;
  47. /* this is being used as an error checker, so if a the entered values arent greater than 0 or arent a number then an error will be shown */
  48. switch (Pidgeys && Candies)
  49. {
  50.    case 0:
  51.    printf("ERROR \nPlease intput values for pidgeys and/or Candies");
  52.    exit(0);
  53. }
  54. /* this line of code is used when the number of candies is greater than the total from multiplying EvolveCandies by Pidgeys */
  55. if (Candies > EvolveCandies*Pidgeys)
  56. {
  57.    printf("The Total number of XP will be %d\n", (Pidgeys*EvolveCandies)/EvolveCandies*EggXP);
  58. }
  59. /* this line of code is executed if the condtions above have not been met*/
  60. else
  61. {
  62. printf("The Total number of XP will be %d\n", TotalXP)
  63. }
  64. /* this is used to tell the user of the program exactly how many pidgeys they have evolved */
  65. if (Pidgeys < 0);
  66. {
  67.    printf("You have evolved %d Pidgey(s)", TotalXP/1000);
  68. }
  69.  
  70. }