# QUESTION 1 (10 points)

Translate each English phrase into a C expression.  Use any variable name desired.

1. Eight times the weight of a Kangaroo.

int kangaroo_weight, total_weight;

total_weight = 8 * kangaroo_weight;

1. The amount in a savings account after eight hundred dollars is added.

double savings_amount, current_savings_amount;

current_savings_amount = savings_amount + 800.0;

# QUESTION 2 (10 points)

When you compile this code you will receive a warning regarding the coversion between a float and a double.  Don’t worry about this warning for now.

#include  <stdio.h>

void main()

{

int       initial_amount = 3027;

float    current_total = 0;

current_total = initial_amount * 7.75;

printf("Current total is:  %f\n", current_total);

}

# QUESTION 3 (10 points)

Trace the variables x, y, z, and w for each line of the program given the input:

10      11      3        2        19

#include <stdio.h>

void main()

{

1.       int x, y, z, w;

2.       scanf("%d%d%d%d", &x, &y, &z, &w);

3.       x = y % z;

4.       z = y - x;

5.       w = w + z;

6.       x = x + y;

7.       printf("%d %d %d %d \n", y, x, z, w);

}

#         x          y          z          w

1          ?          ?          ?          ?

2          10        11        3          2

3          2          11        3          2

4          2          11        9          2

5          2          11        9          11

6          13        11        9          11

7          output:  11    13   9  11

# QUESTION 4 (10 points)

What’s up!

What’s up!!!What’s up!!!!!!!!

# QUESTION 5 (10 points)

Yes.  The ‘total’ variable will keep  adding the next even integer between 2 and 40.  The following is the ‘total’ variable pattern as the loop is iterating:

Count             (total = total + 2 * count)

0                                            0

1                                            0 + 2*1 = 0 + 2 = 2

2                                            2 + 2*2 = 2 + 4 = 6

3                                            6 + 2*3 = 6 + 6 = 12

4                                            12 + 2*4 = 12 + 8 = 20

5                                            20 + 2*5 = 20 + 10 = 30

20

Happy Halloween.

Happy Halloween.

Happy Halloween.

Happy Halloween.

Happy Halloween.