There are three compiler warnings with this code. Can you spot them?

```
int main()
{
float a = 4.0, b = 8.0, c = 1.5;
int x = 5, y = 7.5, z = 19.0;
float q, r;
int s, t;
s = x + z/y*c;
t = b/a * b*x + c;
q = y * a+a * c;
r = z % x+b/a;
```

```

int main()

{

float a = 4.0, b = 8.0, c = 1.5; //warnings here

int x = 5, y = 7.5, z = 19.0; //warnings here

float q, r;

int s, t;

s = x + z/y*c;

t = b/a * b*x + c;

q = y * a+a * c;

r = z % x+b/a;

```



```

s = x + z/y*c;

/* s = 5 + 19/7*1.5

= 5 + 2 * 1.5

= 5 + 3.0

= 8.0 */



t = b/a * b*x + c;

/* t = 8.000000/4.00000 * 8.000000 * 5 + 1.500000

= 2.000000 * 8.000000 * 5 + 1.500000

= 16.000000 * 5 + 1.500000

= 80.000000 + 1.500000

= 81.5000000 (remember t is an int) */





q = y * a+a * c;

/* q = 7 * 4.000000 + 4.00000 * 1.50000

= 28.00000 + 4.00000 * 1.500000

= 28.00000 + 6.00000

= 34.00000 */



r = z % x+b/a;

/* r = 19 % 5 + 8.00000/4.00000

= 4 + 8.00000/4.00000

= 4 + 2.00000

= 6.00000 */<

Computer Science & Information Technology

You might also like to view...

Show Title is a toggle setting that can be used to display and hide the toolbar title

Indicate whether the statement is true or false

Computer Science & Information Technology

Use the ______ attribute on a element to associate it with a table heading cell.

a. th b. headers c. heading d. title

Computer Science & Information Technology