<mosaic.cnfolio.com>
PROGRAM
  1. /*START
  2.    Read number of Pidgey pokemons
  3.    Read amount of Pidgey candy
  4.    IF Pidgey pokemons or Pidgey candy is an integer
  5.       THEN
  6.          If number of Pidgey pokemons is greater than 0
  7.         THEN
  8.                If amount of candy is greater than 11
  9.             THEN
  10.                      
  11.                      Add the number of pidgeys to the Pidgey candy to work out pidgey back
  12.                      WHILE Pidgey candy is less than or equal to amount of candy OR there are no Pidgeys
  13.                         add 1000 for each evolution
  14.                         romove 1 Pidgey from number of Pidgeys due to a Pidgey being evolved
  15.                         remove 12 Pidgey Candy due them being used in the evolution
  16.                      NEXT
  17.                      Display total XP
  18.                   ELSE
  19.                      Display you don't have enough candy to evolve any pokemon
  20.                  
  21.                END IF
  22.             ELSE
  23.                Display you don't have any pokemon so do not use the lucky egg
  24.          END IF
  25.       ELSE
  26.          Display error due to value not being an integer
  27.    END IF
  28.            
  29.    END
  30. */
  31.  
  32. #include <stdio.h>
  33.  
  34. int main(void)
  35.  
  36. {
  37.  
  38.    int numberofPidgey;
  39.    int PidgeyCandy;
  40.    int EvolvedCandy;
  41.    int maximumPidgeyEvolve;
  42.    int Pidgeyxp = 0;
  43.    int Evolutions = 0;
  44.    int CandyUsed = 0;
  45.    int OriginalPidgeyCandy = 0;
  46.    
  47.    scanf("%d", &numberofPidgey);
  48.    scanf("%d", &PidgeyCandy);
  49.    OriginalPidgeyCandy = PidgeyCandy;
  50.    if (numberofPidgey > 0)
  51.    {
  52.       if (PidgeyCandy > 11)
  53.       { 
  54.          if (PidgeyCandy <= numberofPidgey)
  55.             PidgeyCandy += numberofPidgey;
  56.          do
  57.          {
  58.             Pidgeyxp += 1000;
  59.             numberofPidgey --;
  60.             PidgeyCandy -= 12;
  61.           // PidgeyCandy ++;
  62.             printf("%d\n", PidgeyCandy);
  63.             //printf("%d\n", Pidgeyxp);
  64.             Evolutions ++;
  65.            
  66.          } while (PidgeyCandy >= 12 && numberofPidgey >= 1);
  67.          printf("%d\n", Pidgeyxp);
  68.          CandyUsed = OriginalPidgeyCandy - PidgeyCandy;
  69.          printf("You have just evolved %d Pidgeys using %d Candies\n", Evolutions, CandyUsed );
  70.          printf("You have just gained %d xp\n", Pidgeyxp);
  71.          printf("You have %d Pidgey left and %d Pidgey Candy left\n", numberofPidgey, PidgeyCandy);
  72.          
  73.       }
  74.       else
  75.       {
  76.          printf("you don't have enough candy to evolve any pokemon");   
  77.       }
  78.      
  79.    }
  80.    else
  81.    {
  82.       printf("you don't have any pokemon so do not use the lucky egg");
  83.    }
  84.    
  85. }