<mosaic.cnfolio.com>
PROGRAM
  1. #include <stdio.h>
  2.  
  3.    int luckyMult = 2;
  4.    int CalMaxExp(int Pidgey, int candies);
  5.    int main(void)
  6.    
  7. {
  8.  
  9.    int numPidgey, numCandy, maxExp;
  10.    char term;
  11.    
  12.    if(scanf("%d%c", &numPidgey, &term) !=2 || term != '\n');
  13.    printf("Number of Pidgeys = %.0f\n");
  14.    
  15.    {
  16.       perror("Invalid Pidgey input");
  17.       /*term='\0'*/
  18.    }
  19.    
  20.  
  21.    if(scanf("%d%c", &numCandy, &term) !=2 || term != '\n');
  22.    printf("Number of Candies = %.0f\n");
  23.  
  24.    {
  25.       perror("Invalid Candy input");
  26.       /*term='\0'*/
  27.    }
  28.    
  29.    
  30.    maxExp=calMaxExp(numPidgey,numCandy);
  31.    printf("Max XP whilst the Lucky Bonus Egg Timer is active: %d", maxExp);
  32.    
  33. }
  34.  
  35. int calMaxExp(int pidgeys,int candies)
  36.  
  37. {
  38.    if(candies<(pidgeys*12));
  39.    
  40.    {
  41.       perror("Not enough Candies to evolve all the Pidgeys.");
  42.       return 0;
  43.    }
  44.    
  45.    return luckyMult*(pidgeys*500);
  46. }