<mosaic.cnfolio.com>
PROGRAM
  1. #include <stdio.h>
  2.  
  3. /*
  4. START
  5.   GET pidgey and candy input values
  6.     IF pidgey value is more than zero
  7.        IF candies value is more than or equal to twelve
  8.            IF the maxevolutions value is less than or equal to the pidgeys value
  9.              WRITE "Experience gained from evolutions = maxevolutions * 1000"
  10.        ELSE
  11.          WRITE "ERROR: You do not have the required candy to evolve a pidgey"
  12.     ELSE
  13.       WRITE "ERROR: You do not have any pidgeys to evolve"
  14. END
  15. */
  16.  
  17.     int main( void )
  18.  
  19.     {
  20.    
  21.     int pidgeys, candies;
  22.    
  23.     scanf( "%d %d", &pidgeys, &candies );
  24.    
  25.     int maxevolutions = candies / 12; /* 12 candies per evolution */
  26.    
  27.     if (pidgeys>0)
  28.    
  29.     {
  30.    
  31.     if (candies>=12)
  32.    
  33.     {
  34.    
  35.     if (maxevolutions<=pidgeys)
  36.    
  37.     {
  38.    
  39.     printf("Experience gained from evolutions %dXP", maxevolutions * 1000); /* 1000XP per evolution with lucky egg */
  40.    
  41.     }
  42.    
  43.     }
  44.    
  45.     else
  46.    
  47.     {
  48.    
  49.     printf("ERROR: You do not have the required candy to evolve a pidgey");
  50.    
  51.     }
  52.    
  53.     }
  54.    
  55.     else
  56.    
  57.     {
  58.    
  59.     printf("ERROR: You do not have any pidgeys to evolve");
  60.    
  61.     }
  62.    
  63.     }