<mosaic.cnfolio.com>
PROGRAM
1. #include <stdio.h>
2.
3. /*
4. START
5.      Get numbers of pidgey pokemons
6.      Get numbers of pidgey candys
7.
8. IF
9.      Candy number is less than 12
10.    DISPLAY Error Message saying you cant evolve pokemon as their is not enough pidgey  candy
11. END IF
12.
13. IF
14.      Numbers of pidgey is less than 1
15.    DISPLAY Error message saying you cant evolve pokemon as their is not enough pidgeys
16. END IF
17.
18. WHILE
19.      Candy number is 12 or more and pidgey number is 1 or more
20.
21.      Evolve Pidgey
22.      Take away 12 candys
23.
24.      Increase candy by 1
25.
26.      Take away 1 from the numbers of pidgey
27.      Add 1000xp to total xp
28.
29. END WHILE
30.
31.
32. */
33.
34. int main (void)
35. {
36.
37. int numbersofpidgey = 0; //declaring variable which is numbers of pidgey
38. int numbersofcandy = 0; //declaring variable which is numbers of candy
39. int totalxp = 0; // declaring variable which is the total xp
40. int totalpidgeotto = 0; // declaring variable which is total pidgeotto
41.
42.
43. scanf("%d %d", &numbersofpidgey , &numbersofcandy);// scanning in the 2 input numbers, numbers of pidgey and numbers of candy
44.
45.
46. if( numbersofcandy < 12) //  if statement for candy, tocheck if its enough to evolve
47. {
48. printf("Your pidgey cannot evolve as their is not enough pidgey candy in your inventory\n");// Displaying error message if candy numbers input is less than 12
49. }
50.
51.  if ( numbersofpidgey < 1 ) // if statement for pidgeys, to check if theirs at least 1 pidgey to evolve
52.  {
53.  printf("You need at least 1 pidgey in your inventory to evolve");// Displaying error message saying i cant evolve pidgey as their is not enough pidgeys in my inventory
54. }
55.
56. while ( numbersofcandy >= 12 && numbersofpidgey >= 1)// Doing a while loop for numbers of candy to evolve is 12 or and numbers of pidgey is 1 or more
57. {
58.  numbersofcandy=numbersofcandy - 12; // Taking away 12 candys from total inventory after evolving pidgey
59. numbersofpidgey=numbersofpidgey - 1;
60. numbersofcandy=numbersofcandy + 1;
61. totalpidgeotto++;
62.
63. totalxp = totalxp + 1000;
64. printf("Your pidgeys have been evolved!\n");
65. printf("You currently have %d candys left in your inventory\n",numbersofcandy);
66. printf("You currently have %d pidgeys left in yoyr inventory\n",numbersofpidgey);
67. printf("You now have %d Pideotto in your inventory\n",totalpidgeotto);
68. printf("The total xp earned is: %d",totalxp);
69. }
70.
71.
72.
73. }