<mosaic.cnfolio.com>
PROGRAM
1. /* Pseudo code*/
2.
3. /* START
4.     READ the amount of pidgey
5.     READ the amount of pidgey 's candy the player have
6.
7.     IF amount of pidgey and the amount of candy is larger than 0
8.
9.     THEN
10.     divide the amount of pidgey by 12
11.
12.     IF  amount of pidgey is greater than the divided number
13.
14.       THEN
15.
16.     multiply the amount of pidgey with 1000
17.      WRITE The amount of exp you can get is amount of pidgey x 1000
18.
19.         ELSE
20.             multiply the divided number with 1000
21.             WRITE the amout of exp you can get is the divided number x 1000
22.         ENDIF
23.
24.     ELSE
26.     ENDIF
27. END
28.
29.
30. */
31.
32.
33.
34.
35. #include <stdio.h>
36.
37. int main()
38. {
39.      float result; /* This is used to calculate how many the player can envovle with their pidgey's candy. Using float because is a divide calulation*/
40.
41.    int exp2 , exp1; /*Exp 1 is the amount of exp that they can get while the player had less pidgey than the amount  they can enovle. */
42.                     /*Exp 2 is the amount of exp that they can get while the player had more pidgey than the amount they can enovle. */
43.
44.
45.    int amt_pid , can_pid; /* This is delcaring amt_pid (amount of pidgey the player have and number of pidgey's candy the player have*/
46.
47.     scanf("%d", &amt_pid);/* scanf is taking the player entered input, in this case is the number of pidgey the player have. */
48.     scanf("%d", &can_pid); /* This scanf is taking input from the player how many pidgey's candy do they have */
49.
50.     if (can_pid > 0 && amt_pid > 0) {    /* This is an if/else statment. This part is to check whether the player had enter vaild number which is any number larger than 0 */
51.        result = can_pid / 12; ;        /* if the statement is true, than divide the amount of candy the player have by 12. Since envolve a pidgey need 12 candys, by dividing it, we can know how many pidgey the player can  possible envolve. */
52.        if (amt_pid < result) {            /* if the amount of pidgey is less than the amount that the player can envolve */
53.          exp1 = amt_pid * 1000;           /* Then mulitple the amount of pidgey that the player have and mulitply by 1000 since envolving one pidgey can get 1000exp with lucky egg bouns timer. */
54.    printf("The amount of exp that you can get is %d\n", exp1 );
55.        }
56.        else {
57.              exp2= result * 1000;         /* if the above statment is false,  mulitply the amount of the player can enovle with 1000 to know the amount of exp the player can get */
58.     printf("The amount of exp that you can get is %d\n", exp2);
59.        }
60.
61.     }
62.     else {
63.         printf("Please check your input!\n")/* This is the error message when the player enter any invalid number such as 0 and -1*/
64.     }
65.
66.
67.    return 0;
68. }