<mosaic.cnfolio.com>
PROGRAM
  1. /*Start
  2. Initialize values pidgey,, rattata, pidgey  candy,rattata candy, pidgey evolve, rattata evolve to 0
  3. Obtain input numbers
  4. IF pidgey<1
  5. THEN DISPLAY Not enough Pidgeys
  6. END IF pidgey > 0
  7. If pidgey candys <12
  8. THEN DISPLAY Not enough pidgey candys
  9. END IF pidgey candies>11
  10. IF rattata < 1
  11. THEN DISPLAY Not enough rattata
  12. END IF rattata >0
  13. IF rattata candy <12
  14. THEN DISPLAY Not enough rattata candy
  15. END IF rattata candy > 11
  16. Calculate how many times it is possibly to pidgey evolve with the amount of pidgey candy there is
  17. Calculate how many times it is possibly to rattata evolve with the amount of rattata candy there is
  18. Compare the value pidgey evolve with number of pidgeys  take that which is smaller
  19. Compare the value rattata evolve with the number of rattata take that which is smaller
  20. With the smaller value of pidgey evolve * by 1000 to get the amount of pidgey xp from evolving pidgeys
  21. With the smaller value of rattata evolve * by 1000 to get the amount of rattata xp from evolving rattatas
  22. DISPLAY the amount of pidgey xp gained
  23. DISPLAY the amount of rattata xp gained
  24. END
  25. */
  26. #include<stdio.h>
  27.  
  28. int main(void)
  29. {
  30. int pc =0;
  31. int p =0;
  32. int pev;
  33. int pxp;
  34. int rc =0;
  35. int r=0;
  36. int rev;
  37. int rxp;
  38.    
  39. scanf("%d %d %d %d", &p, &pc, &r, &rc);
  40.  
  41. pev=pc/12;
  42. rev=rc/12;
  43.  
  44. if (pev > p)
  45. pev=p;
  46. else if (pev < p)
  47. pev=pev;
  48. pxp=pev*1000;
  49. if (rev >r)
  50. rev=r;
  51. else if (rev<r)
  52. rev=rev;
  53. rxp=rev*1000;
  54.  
  55.  
  56. if (p < 1)
  57. printf(" Sorry you dont have any pidgeys to evolve");
  58. if (pc < 12)
  59. printf(" Sorry you dont have enough pidgey candy to evolve");
  60.    
  61.  
  62. else if (pev > 0)
  63. printf( " The amount of xp you will gain from evolving pidgeys is %d" , pxp);
  64. if (r<1)
  65. printf("                                                                  sorry you don't have any rattatas to evolve");
  66. if (rc<12)
  67. printf("                                                                   Sorry you don't have enough rattata candy to evovle");
  68. else if (rev>0)
  69. printf ("                                                                  The amount of xp you will gain from evolving rattatas is %d", rxp);
  70. printf("                                                                                                                                        The total xp you gain is %d", rxp+pxp);
  71. }