<mosaic.cnfolio.com>

- /* Pseudo code*/
- /* START
- READ the amount of pidgey
- READ the amount of pidgey 's candy the player have
- IF amount of pidgey and the amount of candy is larger than 0
- THEN
- divide the amount of pidgey by 12
- IF amount of pidgey is greater than the divided number
- THEN
- multiply the amount of pidgey with 1000
- WRITE The amount of exp you can get is amount of pidgey x 1000
- ELSE
- multiply the divided number with 1000
- WRITE the amout of exp you can get is the divided number x 1000
- ENDIF
- ELSE
- WRITE Please check your input!
- ENDIF
- END
- */
- #include <stdio.h>
- int main()
- {
- 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*/
- 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. */
- /*Exp 2 is the amount of exp that they can get while the player had more pidgey than the amount they can enovle. */
- 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*/
- scanf("%d", &amt_pid);/* scanf is taking the player entered input, in this case is the number of pidgey the player have. */
- scanf("%d", &can_pid); /* This scanf is taking input from the player how many pidgey's candy do they have */
- 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 */
- 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. */
- if (amt_pid < result) { /* if the amount of pidgey is less than the amount that the player can envolve */
- 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. */
- }
- else {
- 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 */
- }
- }
- else {
- printf("Please check your input!\n"); /* This is the error message when the player enter any invalid number such as 0 and -1*/
- }
- return 0;
- }