<mosaic.cnfolio.com>
PROGRAM
1. /*Declare “Candy” as Integer and set to 0
2. Declare “Pidgey” as Integer and set to 0
3. Declare “XP” as Integer and set to 0
4. Print “Enter Pidgey amount”
5.
6. Scan for input
7. Set “Pidgey” value as the input
8. If input is less than 1
9. THEN
10. Print “Not enough Pidgey”
11. Else
12. Print “You have enough Pidgey”
13. End IF
14. Print “Enter Candy amount”
15.
16. Scan for input
17. Set “Candy” value as the input
18. If input is less than 1
19. THEN
20. Print “Not enough Candt”
21. Else
22. Print “You have enough Candy”
23. End IF
24.
25. While candy is greater than or equal to 12 and Pidgey is greater than or equal to 1
26. Statement
27. End While
28.
29. Print amount of XP to gain
30. Print left over Candy
31. Print left over Pidgey
32.
33. */
34.
35. #include <stdio.h>
36. int main()
37. {
38.   int Candy = 0;      /* Here I declare the variable candy as a integer and initialize it with the value 0 */
39.   int Pidgey = 0;     /* Here I declare the variable pidgey as a integer and initialize it with the value 0 */
40.   int XP = 0;         /* Here I declare the variable XP as a integer and initialize it with the value 0 */
41.
42.   printf("Enter Pidgey Amount: ");   /* It displays the message which is a request for a input which is the amount of Pidgey */
43.   scanf("%d", &Pidgey);              /* It scans for the requsted input and makes the input the value of integer "Pidgey" */
44.   if ((Pidgey < 1))                  /* This checks if the input was less than 1*/
45.   {
46.     printf("You have %d at least 1 is needed. \n", Pidgey)/* If the statment is true it displays this message */
47.   }
48.   else
49.   {
50.     printf("You have %d. \n", Pidgey)/*If the statement is false this message is displayed */
51.   }
52.
53.   printf("Enter Candy Amount: ");    /* It displays the message which is a request for a input which is the amount of Candy */
54.   scanf("%d", &Candy);               /* It scans for the requsted input and makes the input the value of integer "Candy" */
55.   if (Candy < 12)                    /* This checks if the input was less than 12*/
56.   {
57.     printf("You have %d at least 12 is needed \n", Candy)/* If the statment is true it displays this message */
58.   }
59.   else
60.   {
61.     printf("You have %d. \n", Candy)/*If the statement is false this message is displayed */
62.   }
63.
64.   while ((Candy >= 12) && (Pidgey >= 1)) /* While this statement is true it will excute the code in curly brackets */
65.   {
66.   XP = XP + 1000;
67.   Candy = Candy - 12;
68.   Pidgey = Pidgey - 1;
69.   }
70.
71.   printf("Extra XP that will be earned with a lucky egg is %d \n ", XP);   /* This prints the amount of XP possible to be earned */
72.   printf("Left over Pidgey = %d \n ", Pidgey);   /* This show the number of left over Pidgey due to there being not enought candy for them all */
73.   printf("Left over Candy = %d", Candy);   /* This shows the left over candy if there wasnt enough pidgey or not enough to evolve another pidgey  */
74. }