<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. START
  3.    Set value of pidgey candies to Zero
  4.    Set value of number of pidgey pokemons to Zero
  5.    Set value of total egg experience points(xp) to Zero
  6.    Read players input pidgey candies
  7.    Read players input number of pidgey pokemons
  8.  
  9.    IF value of the players pidgey candies is less than or equal to 11
  10.       THEN
  11.          Display error message of "Need more pidgey candies"
  12.    END IF
  13.  
  14.    IF value of the players pidgey pokemons is less than or equal to 0
  15.       THEN
  16.          Display error message of "Need more pidgey pokemons"
  17.    END IF
  18.  
  19.    WHILE total of pidgey candies is more or equal to 12 AND
  20.          number of pidgey pokemons are more than 0
  21.          Add 1000 to total egg experience points
  22.          Subtract 11 off of pidgey candies
  23.          Subtract 1 off of number of pidgey pokemons
  24.    END WHILE
  25.    
  26.    IF value of pidgey pokemons is less than or equal to 0
  27.       THEN
  28.          Add and display 11 to the number of pidgey candies
  29.         Display 0 for the number of pidgey pokemons AND total egg experience points
  30.          
  31.       ELSE
  32.          IF value of pidgey pokemons more or equal to 1
  33.             THEN
  34.                Display the players total egg experience points value
  35.                   
  36.                   END IF
  37.             END IF
  38. END
  39. */
  40.  
  41. #include <stdio.h>
  42. int main (void)
  43. {
  44.    int pidgeycandies = 0;
  45.    int numberofpidgeypokemons = 0;
  46.    int totaleggxp = 0;
  47.    /* The reason for the intial integer to be set as zero for pidgey candies, number of pidgey pokemons
  48.    and total egg experience points as I wanted to avoid the program from using values that have been
  49.    previously stored. As well as this, I did not want the program to be using numbers that included decimals
  50.    when trying to compile.
  51.    */
  52.    
  53.    
  54.    scanf ("%d", &pidgeycandies);
  55.    scanf ("%d", &numberofpidgeypokemons);
  56.    
  57.    if (pidgeycandies <= 11)
  58.    {
  59.    printf("Error Message: Need more pidgey candies");
  60.    }
  61.    
  62.    if (numberofpidgeypokemons <= 0)
  63.    {
  64.    printf ("\n Error Message: Need more pidgey pokemons");
  65.    }
  66.    
  67.    /* The two IF statements were used in order for the error messages to appear because IF statements
  68.    can clearly show the criteria in which is needed and when writing out pseudo code I wanted both error
  69.    messages to appear at the same time if need be and so I felt it was the easiest option to include
  70.    two seperate IF statements.
  71.    */
  72.    
  73.    while (numberofpidgeypokemons >= 1, pidgeycandies >= 12)
  74.    {
  75.    totaleggxp = totaleggxp + 1000;
  76.    pidgeycandies = pidgeycandies - 11;
  77.    numberofpidgeypokemons = numberofpidgeypokemons - 1;
  78.    }
  79.    /* This while loop is used as I needed two criterias which needed to be met and for loop was
  80.    unable to complete this action as it primarily can only execute one criteria and I needed two criteria's
  81.    simultaneously*/
  82.  
  83.   if (numberofpidgeypokemons <=0)
  84.    {
  85.    printf ("\n %d, 0, 0", pidgeycandies + 11);
  86.    }
  87.  
  88.   else if (numberofpidgeypokemons >=1)
  89.    {
  90.    printf("\n %d pidgey candies, %d number of pidgey pokemons, %d total egg xp", pidgeycandies, numberofpidgeypokemons, totaleggxp);
  91.    /* This section from line 69 - 76 was added because a negative value appeared when 0 was entered as
  92.    a number of pidgey pokemons, and so this if/ else statment automatically sets the number of pidgey
  93.    pokemons and totaleggxp to 0 but the number of the players pidgey candies that they currently have
  94.    is displayed. */
  95.    }
  96.    
  97. }