<mosaic.cnfolio.com>
PROGRAM
1. /*
2. START
3.
4.       Set the minimum number of Pidgeys is 1
5.       Set the minimum number of Candies is 12
6.       Initialize Sum to 1
7.
8.       Scan for the two input values of Pidgies and Candies
9.
10.       IF Pidgeys AND Candies are equal to or greater their respective minimums
11.
12.          THEN
13.
14.                IF Pidgeys are less than or equal to Candies divided by twelve
15.
16.                   THEN
17.
18.                            output the total xp which is pidgeys multiplied by 1000 and state the remaining Candies and Pidgeys
19.
20.                   ELSE IF Pidgeys are greater than Candies divided by 12
21.
22.                            WHILE the number of Pidgeys minus Sum in terms of candies is greater than the number of Candies
23.
24.                                  add one to the sum
25.
26.                        END WHILE
27.
28.                            output the total xp which is the number of Pidgies minus the Sum multiplied by 1000 and the number of remaining Pidgeys and Candies
29.
30.                   END IF
31.
32.                   ELSE
33.
34.                         output please enter valid values
35.
36.           END IF
37.
38.       END IF
39.
40. END
41. */
42.
43.
44.                                                                                                                                                 /* Hi there, I'm Ben and this is my Programming Coursework */
45.
46. #include<stdio.h>
47. int main(void)                                            /* All numbers in the main sequence are intergers, after the sequence has finished no data is saved */
48.
49. {
50.
51. int Pidgeys, Candies;                                                                                                                           /* these two data identifiers, Pidgeys and Candies, are both intergers */
52. int MinP = 1;                                                                                        /* the Data Identifier MinP is an interger and is equal to 1 */
53. int MinC = 12;                                                                                                                                  /* the Data Identifier MinC is an interger and is equal to 12 */
54. int Sum  = 1;                                            /* initialize Sum to 1 */
55.
56. scanf("%d %d", &Pidgeys, &Candies);                                                                                                             /* scan for two interger inputs and assign them to the data identifiers Pidgeys and Candies respectivley */
57.
58. {
59. if((Pidgeys >= MinP) && (Candies >= MinC))                                                                     /* IF Pidgeys AND Candies are both above their respective minimums then carry out the statment below */
60.
61.    {
62.    if((Pidgeys <= (Candies/12)))                                                                                                                /* IF the number of Pidgeys is less than or equal to the equivilent number of Candies carry out the statment */
63.       printf ("Total XP is %d XP, you have 0 Pidgeys left and %d Candies left.", Pidgeys*1000, Candies-(Pidgeys*12));                           /* PRINT the total XP, which is the number of Pidgeys multiplied by 1000, the number of remaining Pidgeys, which is always 0, and the number of reamining Candies, which is Candies minus the number of used Candies */
64.
65.    else if ((Pidgeys > (Candies/12)))                                     /* ELSE IF the number of Pidgeys is greater than the equivelent number of Candies carry out the stament below */
66.             {
67.             while (((Pidgeys - Sum)*12) > Candies)                                /* WHILE Pidgeys*12 minus Sum*12 is greater than Candies carry out the statment below */
68.
69.             {
70.             Sum = Sum + 1;                                        /* Sum is equal to Sum minus 1 */
71.             }
72.
73.             printf("Total XP is %d XP, you have %d Pidgeys left and %d Candies left.", (Pidgeys - Sum)*1000, Sum, Candies-((Pidgeys-Sum)*12));  /* PRINT total XP, which is Pidgeys*1000 minus Sum*1000, number of remaining Pidgeys, which is Sum, and number of remaining Candies, which is Candies minus Pidgeys*12 minus Sum*12 */
74.             }
75.    }
76.
77. else printf("Please enter valid values");                                   /* PRINT Error message */
78. }
79.
80. }