<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. READ number of pidgeys
  3. READ number of pidgey candies
  4.  
  5. IF number obtained is not a positive number.
  6.    THEN display error message
  7. END IF
  8.  
  9. WHILE there are 12 or more pidgey candies, and there are 1 or more pidgeys.
  10.       subtract 12 from pidgey candies
  11.       subtract 1 from number of pidgeys
  12.       increase evolutions by 1
  13.       add 1 to pidgey candy
  14. END WHILE
  15.  
  16. XP is equal to evolutions multiplied by 1000
  17.  
  18. Display XP value
  19. */
  20.  
  21. #include <stdio.h>
  22. int main ( void )
  23. {
  24.   int pidgeys = 0;
  25.   int pidgeycandy = 0;
  26.   int evolutions = 0;
  27.  
  28.  
  29.   scanf("%d %d",&pidgeys, &pidgeycandy);
  30.  
  31.   if (pidgeys < 1 || pidgeycandy < 1 )
  32.      {
  33.      printf("please input 2 positive numbers");
  34.      exit(0);
  35.      } 
  36.   while (pidgeys > 0 && pidgeycandy >= 12 ) /*used because the number of cycles is not known*/
  37.   {
  38.      pidgeycandy = pidgeycandy - 12;
  39.      pidgeys-- ;
  40.      evolutions++ ;
  41.      pidgeycandy++ ;       
  42.   }
  43.   int XP = 1000*evolutions;
  44.   printf( "%d evolutions and the XP earned is %d",evolutions, XP);
  45. }