<mosaic.cnfolio.com>
PROGRAM
1. /*
2. START
3. Use two integers, pidgeypokemons and pidgeycandies
4. Work out the maximum xp
5. Calculate the amount of evolutions
6.
7. depending on the amount of pidgeypokemons and candies
8. we can calculate the amount of evolutions
9. also the maximum amount of xp gained
10.
11. if there is less pidgeypokemons than the evolution amount
12. then the player is able to evolve their pokemon
13. so they get the maximum amount of xp which is 1000
14.
15. if the amount of pidgey pokemons is below 0 so a minus number
16. then an error message will pop up as they cannot evolve their pokemon
17.
18. if the amount of pokemons is equal to 0
19. then an error message will not allow the user to evolve their pidgey
20.
21. if the amount of pidgey candies is below 0
22. then the user cannot evolve their pidgey
23.
24. if the amount of pidgey candies is equal to 0
25. then the error message will pop up to not allow an evolution
26.
27. the final message which uses printf in the sentence
28. basically says to display the maximum xp gain
29.
30. END
31. */
32.
33. #include <stdio.h>
34.
35. int main(void)
36. {
37.    int pidgeypokemons; // the amount of pidgey pokemons.
38.    int pidgeycandies; // the amount of pidgey candy.
39.    int maximumxp; // maximum amount of xp that can be gained.
40.    int evolutionamount; // amount of times the pokemon can evolve.
41. }
42.
43.    scanf("%d %d", &pidgeypokemons, &pidgeycandies);
44.    evolutionamount = (pidgeycandies/12);
45.    maximumxp = (500*2*evolutionamount);
46.
47.
48.    if (pidgeypokemons < evolutionamount);
49.    {
50.    maximumxp = 500*2*pidgeypokemons;
51.    }
52.    if (pidgeypokemons > evolutionamount);
53.    {
54.    maximumxp = (500*2*evolutionamount);
55.    }
56.
57.    if (pidgeypokemons < 0);
58.    {
59.      (maximumxp = 0);
60.      fprintf(stderr,"Error: you dont have enough pokemons/n");
61.    }
62.
63.    if (pidgeypokemons == 0);
64.    {
65.      (maximumxp = 0);
66.      fprintf(stderr, "Error: you dont have enough pokemons/n");
67.    }
68.    if (pidgeycandies < 0)
69.    {
70.      (maximumxp = 0);
71.      fprintf(stderr, "Error: you dont have enough candies/n");
72.    }
73.    if (pidgeycandies == 0)
74.    {
75.       maximumxp = 0
76.       fprintf(stderr, "Error: you dont have enough candies/n");
77.    }
78.
79.   printf("maximum xp = %d",maximumxp);
80.    }