<mosaic.cnfolio.com>
PROGRAM
  1. /*
  2. START
  3.    Obtain number of pidgey and pidgey candies
  4.    Display number of pidgey and pidgey candies
  5.    IF number of pidgey is less than zero or equal to zero
  6.       THEN
  7.          Display error message
  8.       ELSE
  9.          IF number or pidgey candies is less than zero ro equal to zero
  10.             THEN
  11.                Display error message
  12.       ElSE
  13.          IF number of pidgey is more than zero and pidgey candy is more than zero but less than twelve
  14.             THEN
  15.                Display error message
  16.       ELSE Display successful message and proceed calculation
  17.        END IF
  18.    WHILE pidgey candy is more or equal to twelve and pidgey is more than one
  19.       Take away input pidgey candies by twelve
  20.       Take away one pidgey after every twelve candies used
  21.       Add one everytime pidgey is evolved
  22.    END WHILE
  23.     Display total xp gained
  24. END
  25. */
  26.  
  27.  
  28. #include <stdio.h>
  29.  
  30. int main()
  31. {
  32. int pidgeys;                  /* This will contain integer for number of pidgeys */
  33. int pidgeycandies;
  34. int pidgeyevolution = 0;
  35. int pidgeytotalxp = 0;
  36. scanf ("%d", &pidgeys);       /* This will read an input for pidgeys */
  37. scanf ("%d", &pidgeycandies);
  38. printf("For PIDGEY\n");
  39. printf("You have %d pidgeys and %d pidgey candies in your inventory.\n", pidgeys, pidgeycandies); /* This prints the number of pidgeys and candies entered by user */
  40.                         
  41. printf("Calculating...\n");
  42.  
  43. if (pidgeys==0) /*this function is executed if the statement is true */
  44. {
  45. printf("ERROR: NO PIDGEYS\n");
  46. }
  47. else if(pidgeycandies==0)
  48. {
  49. printf("ERROR: NO CANDIES\n");
  50. }
  51. else if(pidgeys <0)
  52. {
  53. printf("ERROR: NEGATIVE PIDGEYS\n");
  54. }
  55. else if(pidgeycandies<0)
  56. {
  57. printf("ERROR: NEGATIVE CANDY\n");
  58. }
  59. else if (pidgeycandies>0 && pidgeycandies<12)
  60. {
  61. printf("NOT ENOUGH CANDIES TO EVOLVE\n");
  62. }
  63. else /*this function is executed when all the above statements are false*/
  64. {
  65. printf("You have sucessfully evolved your pidgey!\n");
  66. }
  67.  
  68. while (pidgeycandies >=12 && pidgeys >0) /*If this statement is true, while loop is executed*/
  69. {
  70. pidgeycandies = pidgeycandies -12; /* This formula takes away number of candies needed to evolve=12 */
  71. pidgeys = pidgeys--; /* This formula takes one away after evolution */
  72. pidgeyevolution = pidgeyevolution++; /*This formula adds the amount of pidgeys evolved to find out the total xp */
  73. }
  74.  
  75. pidgeytotalxp = 2*500*pidgeyevolution; /*Lucky Egg bonus gives double xp, hence 2*500xp */
  76.  
  77. printf("You have gained %dxp and have %d pidgey candies left.\n\n\n", pidgeytotalxp, pidgeycandies); /* This prints the total xp and candy remainder */
  78.  
  79.  
  80.  
  81. /* The following fuction is for Rattata */
  82. printf("For RATTATA\n");
  83. int rattata;                  /* This will contain integer for number of rattata */
  84. int rattatacandies;
  85. int rattataevolution = 0;
  86. int rattatatotalxp = 0;
  87. scanf ("%d", &rattata);       /* This will read an input for rattata */
  88. scanf ("%d", &rattatacandies);
  89. printf("YOu have %d rattata and %d rattata candies in your inventory.\n", rattata, rattatacandies); /* This prints the number of rattata and candies entered by user */
  90.                         
  91. printf("Calculating...\n");
  92.  
  93. if (rattata==0) /*this function is executed if the statement is true */
  94. {
  95. printf("ERROR: NO RATTATA\n");
  96. }
  97. else if(rattatacandies==0)
  98. {
  99. printf("ERROR: NO CANDIES\n");
  100. }
  101. else if(rattata <0)
  102. {
  103. printf("ERROR: NEGATIVE RATTATA\n");
  104. }
  105. else if(rattatacandies<0)
  106. {
  107. printf("ERROR: NEGATIVE CANDY\n");
  108. }
  109. else if (rattatacandies>0 && rattatacandies<25)
  110. {
  111. printf("NOT ENOUGH CANDIES TO EVOLVE\n");
  112. }
  113. else /*this function is executed when all the above statements are false*/
  114. {
  115. printf("You have sucessfully evolved your ratatta!\n");
  116. }
  117.  
  118. while (rattatacandies >=25 && rattata >0) /*If this statement is true, while loop is executed*/
  119. {
  120. rattatacandies = rattatacandies -25; /* This formula takes away number of candies needed to evolve=25 */
  121. rattata = rattata--; /* This formula takes one away after evolution */
  122. rattataevolution = rattataevolution++; /*This formula adds the amount of rattata evolved to find out the total xp */
  123. }
  124.  
  125. rattatatotalxp = 2*500*rattataevolution; /*Lucky Egg bonus gives double xp, hence 2*500xp */
  126.  
  127. printf("You have gained %dxp and have %d rattata candies left.\n\n\n", rattatatotalxp, rattatacandies); /* This prints the total xp and candy remainder */
  128.  
  129.  
  130. /* The following fuction is for Zubat */
  131. printf("For ZUBAT\n");
  132. int zubat;            /* This will contain integer for number of zubat */
  133. int zubatcandies;
  134. int zubatevolution = 0;
  135. int zubattotalxp = 0;
  136. scanf ("%d", &zubat);       /* This reads an input for zubat */
  137. scanf ("%d", &zubatcandies);
  138. printf("YOu have %d zubat and %d zubat candies in your inventory.\n", zubat, zubatcandies); /* This prints the number of rattata and candies entered by user */
  139.                         
  140. printf("Calculating...\n");
  141.  
  142. if (zubat==0) /*this function is executed if the statement is true */
  143. {
  144. printf("ERROR: NO ZUBAT\n");
  145. }
  146. else if(zubatcandies==0)
  147. {
  148. printf("ERROR: NO CANDY\n");
  149. }
  150. else if(zubat <0)
  151. {
  152. printf("ERROR: NEGATIVE ZUBAT\n");
  153. }
  154. else if(zubatcandies<0)
  155. {
  156. printf("ERROR: NEGATIVE CANDY\n");
  157. }
  158. else if (zubatcandies>0 && zubatcandies<25)
  159. {
  160. printf("NOT ENOUGH CANDIES TO EVOLVE\n");
  161. }
  162. else /*this function is executed when all the above statements are false*/
  163. {
  164. printf("You have sucessfully evolved your zubat!\n");
  165. }
  166.  
  167. while (zubatcandies >=50 && zubat >0) /*If this statement is true, while loop is executed*/
  168. {
  169. zubatcandies = zubatcandies -50; /* This formula takes away number of candies needed to evolve=50 */
  170. zubat = zubat--; /* This formula takes one away after evolution */
  171. zubatevolution = zubatevolution++; /*This formula adds the amount of zubat evolved to find out the total xp */
  172. }
  173.  
  174. zubattotalxp = 2*500*zubatevolution; /*Lucky Egg bonus gives double xp, hence 2*500xp */
  175.  
  176. printf("You have gained %dxp and have %d zubat candies left.\n", zubattotalxp, zubatcandies); /* This prints the total xp and candy remainder */
  177. }